Re: Export CSV from psql

From: "Craig O'Shannessy" <craig(at)ucw(dot)com(dot)au>
To: Alex <alex(at)meerkatsoft(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Export CSV from psql
Date: 2003-11-20 03:53:23
Message-ID: Pine.LNX.4.44.0311201449100.14188-100000@mail.ucw.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I use the standard pipe signs as delimiters, comma's are a pretty silly
delimiter if you ask me. Try putting this at the top of your psql query

-- \a toggle between unaligned and aligned output mode
-- \t show only rows (currently off)
-- \o [FILE] send all query results to file or |pipe
\a
\t
\o /tmp/outputfile.txt
select ......
\o

Don't know if this helps you, or if you really need CSV. Someone probably
has written a CSV export I 'spose.

Best of luck.

Craig

On Thu, 20 Nov 2003, Alex wrote:

> Hi,
> is there a way to display the table in CSV format or write a query in
> csv to a file ?
>
> Alex
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message K. Deepa 2003-11-20 05:30:24 Is it possible find a size of a table
Previous Message Alex 2003-11-20 03:38:41 Export CSV from psql