Re: importing tab delimited, text enclosed by "

Lists: pgsql-general
From: Andrew Gould <andrewgould(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: importing tab delimited, text enclosed by "
Date: 2000-09-26 16:08:40
Message-ID: 20000926160840.16077.qmail@web109.yahoomail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

I have a file of data that is tab delimited, with text
fields enclosed by quotation marks.

I know I can use the copy command to load the data;
and that tab delimited is the default. How do I tell
Postgres to remove the quotation marks?

I'm running PostgreSQL 7.0.2 on Linux (Caldera
eDesktop 2.4)

Thanks,

Andrew Gould

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/


From: Holger Klawitter <holger(at)klawitter(dot)de>
To: Andrew Gould <andrewgould(at)yahoo(dot)com>, "pgsql-general(at)postgreSQL(dot)org" <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: importing tab delimited, text enclosed by "
Date: 2000-09-27 07:43:08
Message-ID: 39D1A50C.85EA0E82@klawitter.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Andrew Gould wrote:
>
> I have a file of data that is tab delimited, with text
> fields enclosed by quotation marks.
>
> I know I can use the copy command to load the data;
> and that tab delimited is the default. How do I tell
> Postgres to remove the quotation marks?

It is probably easiest to remove the quote with a script
(like the following perl program).

while(<>){
chop;
@a = split(/\t/,$_);
@a = map { s/^"(.*)"$/$1/; $_; } @a;
printf "%s\n", join("\t",@a);
}

Regards,
Mit freundlichem Gruß,
Holger Klawitter
--
Holger Klawitter +49 (0)251 484 0637
holger(at)klawitter(dot)de http://www.klawitter.de/