<p><font size="2">Hi Andrew,<br /><br /> > Right. There's a simple pipeline way to get rid of it:<br /> > psql
-t-f query.sql | sed -e '$d' > query.out<br /><br /> Hi Scott,<br /><br /> > Tired of those blank lines in your
textfiles? Grep them away:<br /> > psql -tf query.sql mydatabase | grep -v "^$" > query.out<br /><br /> Thank
youBoth.<br /><br /> Regards,<br /><br /> Tena Sakai<br /> tsakai@gallo.ucsf.edu<br /><br /><br /> -----Original
Message-----<br/> From: Andrew Dunstan [<a href="mailto:andrew@dunslane.net">mailto:andrew@dunslane.net</a>]<br />
Sent:Thu 4/2/2009 6:34 PM<br /> To: Tom Lane<br /> Cc: Tena Sakai; pgsql-sql@postgresql.org;
pgsql-hackers@postgresql.org<br/> Subject: Re: [HACKERS] [SQL] How would I get rid of trailing blank line?<br /><br
/><br/><br /> Tom Lane wrote:<br /> > "Tena Sakai" <tsakai@gallo.ucsf.edu> writes:<br /> > <br /> >>
Ioften use a line like:<br /> >> psql -tf query.sql mydatabase > query.out<br /> >> <br /> ><br
/>> <br /> >> -t option gets rid of the heading and count<br /> >> report at the bottom. There is a
blankline<br /> >> at the bottom, however. Is there any way to<br /> >> have psql not give me that blank
line?<br/> >> <br /> ><br /> > Doesn't look like it --- the final fputc('\n', fout); seems to be<br />
>done unconditionally in all the output formats. I wonder if we should<br /> > change that? I'm afraid it might
breakprograms that are used to it :-(<br /> ><br /> ><br /> > <br /><br /> Right. There's a simple pipeline
wayto get rid of it:<br /><br /> psql -t -f query.sql | sed -e '$d' > query.out<br /><br /><br /> cheers<br
/><br/> andrew<br /><br /></font>