|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
select results...
Hi
I am writing a bash script at the moment and as a part of it I need to extract all the info from a db column to a text file. Quote:
But the problem is that the name.txt file comes out as such... Quote:
Is there any way to set the select not to print these or should I just write something to parse out the heading lines and the space before the name? Cheers.... |
|
#2
|
|||
|
|||
|
I belive you can customize your psql not to print them.
|
|
#3
|
|||
|
|||
|
I think there is a psql option also, but you could use head/tail to strip off those two lines, right? I have to write bash stuff too sometimes, but how come you are not using perl or python?
|
|
#4
|
|||
|
|||
|
more specifically, now you can do it with a command-line option:
-t --tuples-only Turn off printing of column names and result row count footers, etc. It is completely equivalent to the \t meta-command. so psql -t -c 'SELECT foo FROM bar;' >> file.txt will not include the headers |
![]() |
| Viewing: Dev Shed Forums > Databases > PostgreSQL Help > select results... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|