Re: request for help with COPY syntax - Mailing list pgsql-sql

From Fernando Hevia
Subject Re: request for help with COPY syntax
Date
Msg-id 032901c81645$9dd007b0$8f01010a@iptel.com.ar
Whole thread Raw
In response to Re: request for help with COPY syntax  ("Chuck D." <pgsql-list@nullmx.com>)
List 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.





pgsql-sql by date:

Previous
From: Paul Lambert
Date:
Subject: Re: Quick question re foreign keys.
Next
From: "Robins Tharakan"
Date:
Subject: Re: Quick question re foreign keys.