Re: replacing CR/LF

From: Ennio-Sr <nasr(dot)laili(at)tin(dot)it>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: replacing CR/LF
Date: 2003-07-12 13:37:56
Message-ID: 20030712133756.GA31608@deby.ei.hnet
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

* Marcus Andree S. Magalhaes <marcus(dot)magalhaes(at)vlinfo(dot)com(dot)br> [110703, 22:49]:
> 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??

Try 'dos2linux' to get rid of ^M (carriage return at end of line)
# Use: dos2linux file_dos file_unix
# Warning: if you use the same name for the two files you will loose
# your data!

Very useful can be 'tr' also:

# tr -d '\015'< $1 > $2
# tr -d '\r'< $1 > $2

# OKOKOK QUESTI COMANDI SONO UTILI:
$ tr '\n' ' ' < provosed> provosed2 # replace space to new-line
$ tr -s '\***' '\§' < provosed2> provosed3 # replaces asterisks with §
$ tr '\§' '\n' < provosed3> provosed2 # replaces § with carriage-return

I hope that helps.
Cheers,
Ennio.
--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo. \\?//
Fa' qualche cosa di cui non sei capace!" (diceva Henry Miller) ] (°|°)
[Why to use Win$ozz (I say) if ... "even a fool can do that. )=(
Do something you aren't good at!" (used to say Henry Miller) ]

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Aarni Ruuhimäki 2003-07-12 15:20:18 Re: replacing CR/LF
Previous Message Jeffrey Melloy 2003-07-12 03:15:08 Re: Dont allow updation for few columns in a record.