Re: Off topic? - Solution for a delimiter problem

From: "Poul L(dot) Christiansen" <poulc(at)cs(dot)auc(dot)dk>
To: Andrew Gould <andrewgould(at)yahoo(dot)com>
Cc: Postgres Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Off topic? - Solution for a delimiter problem
Date: 2000-12-20 22:25:59
Message-ID: 3A4131F6.C26AF3B6@cs.auc.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Maybe you can specify the delimiter to be space.

radius=# \h copy
Command: COPY
Description: Copies data between files and tables
Syntax:
COPY [ BINARY ] table [ WITH OIDS ]
FROM { 'filename' | stdin }
[ [USING] DELIMITERS 'delimiter' ]
[ WITH NULL AS 'null string' ]
COPY [ BINARY ] table [ WITH OIDS ]
TO { 'filename' | stdout }
[ [USING] DELIMITERS 'delimiter' ]
[ WITH NULL AS 'null string' ]

That would probably be COPY table FROM filename USING DELIMITERS ' ';

HTH,
Poul L. Christiansen

Andrew Gould wrote:

> I receive space delimited files that have spaces
> within double quoted text fields.
>
> Since PostgreSQL's COPY doesn't deal with multiple
> delimiters, I've written a crude Python script to
> convert the files to a tab delimited format without
> the double quotes and without disturbing the spaces
> within text fields. I'm sure someone could make it
> more efficient. (Probably by rewriting it in Perl.)
>
> Does anyone else need the script? Is the script
> something I can/should post?
>
> Andrew Gould
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mirko Zeibig 2000-12-20 23:18:14 Best way to replicate a DB between two servers (master/slave)
Previous Message Andrew Gould 2000-12-20 21:52:53 Off topic? - Solution for a delimiter problem