Обсуждение: Appending \o output instead of overwriting the output file

Поиск
Список
Период
Сортировка

Appending \o output instead of overwriting the output file

От
"Brent Wood"
Дата:
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

От
Tom Lane
Дата:
"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

От
Abdul Rahman
Дата:
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.