Re: request for help with COPY syntax

From: "Fernando Hevia" <fhevia(at)ip-tel(dot)com(dot)ar>
To: <pgsql-list(at)nullmx(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: request for help with COPY syntax
Date: 2007-10-24 13:56:03
Message-ID: 032901c81645$9dd007b0$8f01010a@iptel.com.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> De: Chuck D.
>
> I'm not sure if they are needed because I've never seen a double quote in
> a
> place name before. I don't believe they are errors though because there
> are
> more records that contain them. As well, some records have single and
> double
> quotes allowed within a record and this really messes things up.
>
> Any ideas? Should I consider removing them in favor of a single quote?
> If
> so, do you know how to do this with sed or similar?
>

Well, hard to say what to do with those quotes without knowing if your query
conditions for places will include them.
I probably would replace them for an underscore or any other uniquely
identifiable character in order to succeed with the copy, and keep the
possibility to later decide if that underscore becomes again a quote or gets
removed all together.

If you would like to just remove single or double quotes you should do:
sed "s/[\'\"]//g" file_with_quotes.txt > file_without_quotes.txt

Say you want to replace quotes with a space, then:
sed "s/[\'\"]/ /g" file_with_quotes.txt > file_without_quotes.txt

Insert whatever you want to replace the quotes between the 2nd and 3rd bar
(/).

Regards,
Fernando.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Robins Tharakan 2007-10-24 14:27:44 Re: Quick question re foreign keys.
Previous Message Christian Kindler 2007-10-24 09:55:06 Re: get only rows for latest version of contents