Re: Exporting 1 text column from all rows from a table to a file per row? - Mailing list pgsql-general

From Thom Brown
Subject Re: Exporting 1 text column from all rows from a table to a file per row?
Date
Msg-id CAA-aLv5MGWV6e08KnHNPa3zOgOgqgZGq=0gOHwscB5y3efoshA@mail.gmail.com
Whole thread Raw
In response to Exporting 1 text column from all rows from a table to a file per row?  (Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>)
List pgsql-general
On 21 November 2011 19:10, Joost Kraaijeveld <J.Kraaijeveld@askesis.nl> wrote:
> Hi,
>
> Is it possible, and if so how, to export a single column of a table into
> a separate file per row? I have a table with ~21000 rows that have a
> column "body1" containing ASCII text and I want to have 21000 separate
> ASCII files, each containing that column "body1". The name of the file
> does not matter, although it would be nice if they had the extension
> "txt".

Does the data contain newlines?  If not, you can just export it to a
single file then use:

split -l 1 exportedfile.txt

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-general by date:

Previous
From: Joost Kraaijeveld
Date:
Subject: Exporting 1 text column from all rows from a table to a file per row?
Next
From: Jason Long
Date:
Subject: Re: Supply Chain Calcs