Re: How would I get rid of trailing blank line? - Mailing list pgsql-sql

From Greg Sabino Mullane
Subject Re: How would I get rid of trailing blank line?
Date
Msg-id f2bd06ed8591a98155db624596667332@biglumber.com
Whole thread Raw
In response to How would I get rid of trailing blank line?  ("Tena Sakai" <tsakai@gallo.ucsf.edu>)
List pgsql-sql
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> 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?

Now that my presenation on psql is over :), I'll share my solution:

psql -AX -qt -c "SELECT ..." | perl -pe 's/^\n// if $.<2'

This strips a newline from the first line only of the output, and
only if the line consists of nothing else. Highly recommended
for cron.

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation
PGP Key: 0x14964AC8 200904052221
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAknZZ0YACgkQvJuQZxSWSsiDAwCglJS9/juQLe8asY3sG9fagbeo
2V4An0p5U6UHGI1KXoe2qQvURX5E5BZo
=Yy0J
-----END PGP SIGNATURE-----




pgsql-sql by date:

Previous
From: John DeSoi
Date:
Subject: Re: pl/pgsql or control structures outside of a function?
Next
From: "Greg Sabino Mullane"
Date:
Subject: Re: Performance problem with row count trigger