Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 382BA632D79; Thu, 2 Apr 2009 22:34:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 77014-02; Thu, 2 Apr 2009 22:34:14 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from alexis.jtlnet.com (alexis.jtlnet.com [69.36.9.81]) by mail.postgresql.org (Postfix) with ESMTP id 1A935632B26; Thu, 2 Apr 2009 22:34:22 -0300 (ADT) Received: from [192.168.10.103] (cpe-075-177-154-027.nc.res.rr.com [::ffff:75.177.154.27]) (TLS: TLSv1/SSLv3,256bits,AES256-SHA) by alexis.jtlnet.com with esmtp; Thu, 02 Apr 2009 21:29:36 -0400 id 000848F5.49D56681.00001819 Message-ID: <49D56798.3090402@dunslane.net> Date: Thu, 02 Apr 2009 21:34:16 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.12) Gecko/20071019 Fedora/1.0.9-3.fc6 pango-text SeaMonkey/1.0.9 MIME-Version: 1.0 To: Tom Lane CC: Tena Sakai , pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [SQL] How would I get rid of trailing blank line? References: <14638.1238713281@sss.pgh.pa.us> In-Reply-To: <14638.1238713281@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL=0.034 X-Spam-Level: X-Archive-Number: 200904/153 X-Sequence-Number: 136256 Tom Lane wrote: > "Tena Sakai" 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