pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fernando Hevia <fhevia@ip-tel.com.ar>
To: pgsql-list@nullmx.com
To: pgsql-sql@postgresql.org
Subject: Re: request for help with COPY syntax
Date: Wed, 24 Oct 2007 10:56:03 -0300
Message-ID: <032901c81645$9dd007b0$8f01010a@iptel.com.ar> (raw)
In-Reply-To: <200710240102.19224.pgsql-list@nullmx.com>



> 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.






view thread (18+ messages)  latest in thread

Message-ID: <032901c81645$9dd007b0$8f01010a@iptel.com.ar>
Permalink:  ../032901c81645$9dd007b0$8f01010a@iptel.com.ar/
Also on:    postgresql.org/message-id/032901c81645$9dd007b0$8f01010a@iptel.com.ar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: fhevia@ip-tel.com.ar, pgsql-list@nullmx.com
  Subject: Re: request for help with COPY syntax
  In-Reply-To: <032901c81645$9dd007b0$8f01010a@iptel.com.ar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox