Hi Guys,
How can i crate a csv file wich I can see the column nams too?
Thnaks a lot
How Can I Create CSV File With the coulumn names?
Moderator: NorbertKrupa
-
- Newbie
- Posts: 16
- Joined: Thu Nov 29, 2012 4:16 pm
Re: How Can I Create CSV File With the coulumn names?
Hi!
Standard
Header:
Now redirect or add option `-o /path/to/csv_file`
Enclosing
Standard
Code: Select all
[ ~ ]$ vsql -c "select * from foo"
id | val
----+-----
1 | a
2 | b
3 | c
(3 rows)
Code: Select all
[ ~ ]$ vsql -F';' -Ac "select * from foo" | grep -v '([0-9]* rows)'
id;val
1;a
2;b
3;c
Enclosing
Code: Select all
[ ~ ]$ vsql -F'","' -Ac "select * from foo" | grep -v '([0-9]* rows)' | sed 's/^\|$/"/g'
"id","val"
"1","a"
"2","b"
"3","c"
-
- Newbie
- Posts: 16
- Joined: Thu Nov 29, 2012 4:16 pm
Re: How Can I Create CSV File With the coulumn names?
UPDATE
and
Code: Select all
[ ~ ]$ vsql -c "select * from Tripple"
a | b | c
----+----+----
69 | 25 | 65
16 | 24 | 20
1 | 78 | 67
18 | 35 | 28
41 | 87 | 4
48 | 46 | 80
(6 rows)
Code: Select all
[ ~ ]$ vsql -P footer=off -F';' -Ac "select * from Tripple"
a;b;c
69;25;65
16;24;20
1;78;67
18;35;28
41;87;4
48;46;80
Re: How Can I Create CSV File With the coulumn names?
Hi may i know how do you get the data before you use the select command?Do you create csv file by yourself ?How ?Thanks
Re: How Can I Create CSV File With the coulumn names?
khine,
The data is already in the table. skWa is extracting it into a csv file...
The data is already in the table. skWa is extracting it into a csv file...
Thanks,
Juliette
Juliette