Re: request for help with COPY syntax

Поиск
Список
Период
Сортировка
От Fernando Hevia
Тема Re: request for help with COPY syntax
Дата
Msg-id 032901c81645$9dd007b0$8f01010a@iptel.com.ar
обсуждение исходный текст
Ответ на Re: request for help with COPY syntax  ("Chuck D." <pgsql-list@nullmx.com>)
Список 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 по дате отправления:

Предыдущее
От: Paul Lambert
Дата:
Сообщение: Re: Quick question re foreign keys.
Следующее
От: "Robins Tharakan"
Дата:
Сообщение: Re: Quick question re foreign keys.