Re: How would I get rid of trailing blank line?

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: How would I get rid of trailing blank line?
Date: 2009-04-06 02:21:59
Message-ID: f2bd06ed8591a98155db624596667332@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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(at)turnstep(dot)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-----

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-04-06 02:38:04 Re: ALTER TABLE ... ALTER COLUMN ... SET DISTINCT
Previous Message Tom Lane 2009-04-06 02:00:36 Re: ALTER TABLE ... ALTER COLUMN ... SET DISTINCT

Browse pgsql-sql by date

  From Date Subject
Next Message Greg Sabino Mullane 2009-04-06 14:29:28 Re: Performance problem with row count trigger
Previous Message John DeSoi 2009-04-04 04:28:40 Re: pl/pgsql or control structures outside of a function?