Command line option

From: David <davidr(at)talamh(dot)org(dot)uk>
To: pgsql-novice(at)postgresql(dot)org
Subject: Command line option
Date: 2006-05-08 23:28:45
Message-ID: 48576A01-93E2-4ADB-99B4-7CA89FF97996@talamh.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi

How do I write my psql command line if I want the output to be tab
separated?

If I use psql interactively, I would go

#psql name_of_db

name_of_db =# \a
name_of_db =# \f '\t'
name_of_db =# \o outputfile.txt
name_of_db =# \i queryfile.sql

This produces nice tab separated output that I can open in Excel and
that is recognised as such.

I understand that my command line should look like this:

psql -A -F something_to_produce_a_tab -f queryfile.sql -o
outputfile.txt name_of_db

But obviously I am struggling to get the string for
something_to_produce_a_tab right. I tried '\t' of course and many
variants of it, but I always ending up inserting the string literally
(more or less).

Can somebody please help? I am on FreeBSD, using the bash shell and
PostgreSQL 8.1.2.

Thanks

DR

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message John Purser 2006-05-08 23:57:46 Re: Command line option
Previous Message Tom Lane 2006-05-08 18:08:43 Re: database size grows (even after vacuum (full and analyze))....