agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Tena Sakai <tsakai@gallo.ucsf.edu>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: [SQL] How would I get rid of trailing blank line?
Date: Thu, 02 Apr 2009 21:34:16 -0400
Message-ID: <49D56798.3090402@dunslane.net> (raw)
In-Reply-To: <14638.1238713281@sss.pgh.pa.us>
References: <FE44E0D7EAD2ED4BB2165071DB8E328C04E84A65@egcrc-ex01.egcrc.org>
	<14638.1238713281@sss.pgh.pa.us>



Tom Lane wrote:
> "Tena Sakai" <tsakai@gallo.ucsf.edu> writes:
>   
>> I often use a line like:
>>   psql -tf query.sql mydatabase > query.out
>>     
>
>   
>> -t option gets rid of the heading and count
>> report at the bottom.  There is a blank line
>> at the bottom, however.  Is there any way to
>> have psql not give me that blank line?
>>     
>
> Doesn't look like it --- the final fputc('\n', fout); seems to be
> done unconditionally in all the output formats.  I wonder if we should
> change that?  I'm afraid it might break programs that are used to it :-(
>
>
>   

Right. There's a simple pipeline way to get rid of it:

    psql -t -f query.sql | sed -e '$d' > query.out


cheers

andrew



view thread (9+ messages)  latest in thread

Message-ID: <49D56798.3090402@dunslane.net>
Permalink:  ../49D56798.3090402@dunslane.net/
Also on:    postgresql.org/message-id/49D56798.3090402@dunslane.net

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andrew@dunslane.net, tgl@sss.pgh.pa.us, tsakai@gallo.ucsf.edu, pgsql-hackers@postgresql.org
  Subject: Re: [SQL] How would I get rid of trailing blank line?
  In-Reply-To: <49D56798.3090402@dunslane.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox