Thread: Appending \o output instead of overwriting the output file

Appending \o output instead of overwriting the output file

From
"Brent Wood"
Date:
Hi,

Using \o to redirect output to a file from the psql command line, is there any way to have the output appended to the
outputfile, rather than overwriting it? 


Thanks,

  Brent Woood

Brent Wood
DBA/GIS consultant
NIWA, Wellington
New Zealand
NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.

Re: Appending \o output instead of overwriting the output file

From
Tom Lane
Date:
"Brent Wood" <b.wood@niwa.co.nz> writes:
> Using \o to redirect output to a file from the psql command line, is there any way to have the output appended to the
outputfile, rather than overwriting it? 

This is pretty grotty, but it works:

\o | cat >>target

Maybe we should provide another way in future...

            regards, tom lane

Re: Appending \o output instead of overwriting the output file

From
Abdul Rahman
Date:
Simply use '\o filename' as you are doing so. Write the queries as much as you want. It will automatically append the result in the specified file. Untill you use '\o' command again with new file name.