From: | Thom Brown <thom(at)linux(dot)com> |
---|---|
To: | Joost Kraaijeveld <J(dot)Kraaijeveld(at)askesis(dot)nl> |
Cc: | PG-General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Exporting 1 text column from all rows from a table to a file per row? |
Date: | 2011-11-21 19:20:53 |
Message-ID: | CAA-aLv5MGWV6e08KnHNPa3zOgOgqgZGq=0gOHwscB5y3efoshA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 21 November 2011 19:10, Joost Kraaijeveld <J(dot)Kraaijeveld(at)askesis(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Jason Long | 2011-11-21 19:44:26 | Re: Supply Chain Calcs |
Previous Message | Joost Kraaijeveld | 2011-11-21 19:10:42 | Exporting 1 text column from all rows from a table to a file per row? |