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

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

From
"Brent Wood"
Date:
Thanks Tom,

That will do trick.

Perhaps \o+ as a future fix for this?


Brent

Brent Wood
DBA/GIS consultant
NIWA, Wellington
New Zealand
>>> Tom Lane <tgl@sss.pgh.pa.us> 02/18/09 7:46 PM >>>
"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

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:
> Perhaps \o+ as a future fix for this?

I'd prefer "\o >>file" but maybe I'm too steeped in unix-isms.

            regards, tom lane

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

From
John R Pierce
Date:
Tom Lane wrote:
> "Brent Wood" <b.wood@niwa.co.nz> writes:
>
>> Perhaps \o+ as a future fix for this?
>>
>
> I'd prefer "\o >>file" but maybe I'm too steeped in unix-isms.
>
>


\o+ is reasonably consistent with the other \ command usages...

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

From
Tom Lane
Date:
John R Pierce <pierce@hogranch.com> writes:
> Tom Lane wrote:
>> "Brent Wood" <b.wood@niwa.co.nz> writes:
>>> Perhaps \o+ as a future fix for this?

>> I'd prefer "\o >>file" but maybe I'm too steeped in unix-isms.

> \o+ is reasonably consistent with the other \ command usages...

Not really; none of the other commands interpret + as meaning "append to
an existing file".  They tend to take it as meaning "do something *in
addition to* what you normally do", not to do something that is
significantly different from the base command.

            regards, tom lane

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

From
Jasen Betts
Date:
On 2009-02-18, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> John R Pierce <pierce@hogranch.com> writes:
>> Tom Lane wrote:
>>> "Brent Wood" <b.wood@niwa.co.nz> writes:
>>>> Perhaps \o+ as a future fix for this?
>
>>> I'd prefer "\o >>file" but maybe I'm too steeped in unix-isms.
>
>> \o+ is reasonably consistent with the other \ command usages...
>
> Not really; none of the other commands interpret + as meaning "append to
> an existing file".  They tend to take it as meaning "do something *in
> addition to* what you normally do", not to do something that is
> significantly different from the base command.

Yes, also if \o already supports | why not other plumbing symbols
like >> and for completeness > (also possibly >& filedescriptor?)


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

From
Geoffrey
Date:
Tom Lane wrote:
> "Brent Wood" <b.wood@niwa.co.nz> writes:
>> Perhaps \o+ as a future fix for this?
>
> I'd prefer "\o >>file" but maybe I'm too steeped in unix-isms.
>
>             regards, tom lane

+1


--
Until later, Geoffrey

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.
  - Benjamin Franklin

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

From
Barbara Stephenson
Date:
I didn't know you had time to look at these..   :)

Geoffrey wrote:
> Tom Lane wrote:
> > "Brent Wood" <b.wood@niwa.co.nz> writes:
> >> Perhaps \o+ as a future fix for this?
> >
> > I'd prefer "\o >>file" but maybe I'm too steeped in unix-isms.
> >
> >    regards, tom lane
>
> +1
>
>
> --
> Until later, Geoffrey
>
> Those who would give up essential Liberty, to purchase a little
> temporary Safety, deserve neither Liberty nor Safety.
>   - Benjamin Franklin

--
Regards,

Barbara Stephenson
EDI Specialist/Programmer
Turbo, division of OHL
2251 Jesse Jewell Pkwy
Gainesville, GA  30507
tel: (678)989-3020 fax: (404)935-6171
barbara@turbocorp.com
www.ohl.com

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

From
Erik Jones
Date:
On Feb 19, 2009, at 3:30 AM, Jasen Betts wrote:

> On 2009-02-18, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> John R Pierce <pierce@hogranch.com> writes:
>>> Tom Lane wrote:
>>>> "Brent Wood" <b.wood@niwa.co.nz> writes:
>>>>> Perhaps \o+ as a future fix for this?
>>
>>>> I'd prefer "\o >>file" but maybe I'm too steeped in unix-isms.
>>
>>> \o+ is reasonably consistent with the other \ command usages...
>>
>> Not really; none of the other commands interpret + as meaning
>> "append to
>> an existing file".  They tend to take it as meaning "do something *in
>> addition to* what you normally do", not to do something that is
>> significantly different from the base command.
>
> Yes, also if \o already supports | why not other plumbing symbols
> like >> and for completeness > (also possibly >& filedescriptor?)

I like that.  Specifying other file descriptors (e.g. 2>) and
redirecting output from on fd to another (#>&) would be nice.

Erik Jones, Database Administrator
Engine Yard
Support, Scalability, Reliability
866.518.9273 x 260
Location: US/Pacific
IRC: mage2k