Re: replacing CR/LF

Поиск
Список
Период
Сортировка
От Rudi Starcevic
Тема Re: replacing CR/LF
Дата
Msg-id 20030712154244.M27969@oasis.net.au
обсуждение исходный текст
Ответ на replacing CR/LF  ("Marcus Andree S. Magalhaes" <marcus.magalhaes@vlinfo.com.br>)
Список pgsql-novice
Hi Marcus,

Yes there is a simple way to fix this.

Many times I've had to export text from windows text files.
Here's how I do it.

After moving the text files onto Linux use this command to
clear up the offending character(s)

cat file.txt | perl -pe 's:\r::g' > file2.txt

Inside file2.txt all the \r have been replaced with nothing.

Lets say now you then need to clean up some pesky $ as well.

Just press the up arrow on your keyboard to bring up the command's
you just executed and edit them a little to look like this:

cat file2.txt | perl -pe 's:\$::g' > file3.txt

As you can see these commands can be handy to clean up all sort's
of characters.

Hope this helps.

Cheers
Rudi.





> Hello, all.
>
> I have some data imported from some windows text files with a couple
> DOS end-of-line characters (CRLF) on it.
>
> Is there any simple way to remove them all, or just replace them
> with a single whitespace character??
>
> thanks.
>
> -------------------------------
>    http://www.vlinfo.com.br
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org




В списке pgsql-novice по дате отправления:

Предыдущее
От: Aarni Ruuhimäki
Дата:
Сообщение: Re: replacing CR/LF
Следующее
От: "Grant Rhodes"
Дата:
Сообщение: Problem with psql interface