Re: replacing CR/LF - Mailing list pgsql-novice

From Rudi Starcevic
Subject Re: replacing CR/LF
Date
Msg-id 20030712154244.M27969@oasis.net.au
Whole thread Raw
In response to replacing CR/LF  ("Marcus Andree S. Magalhaes" <marcus.magalhaes@vlinfo.com.br>)
List 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 by date:

Previous
From: Aarni Ruuhimäki
Date:
Subject: Re: replacing CR/LF
Next
From: "Grant Rhodes"
Date:
Subject: Problem with psql interface