Re: replacing CR/LF
От | Ennio-Sr |
---|---|
Тема | Re: replacing CR/LF |
Дата | |
Msg-id | 20030712133756.GA31608@deby.ei.hnet обсуждение исходный текст |
Ответ на | replacing CR/LF ("Marcus Andree S. Magalhaes" <marcus.magalhaes@vlinfo.com.br>) |
Список | pgsql-novice |
* Marcus Andree S. Magalhaes <marcus.magalhaes@vlinfo.com.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) ]
В списке pgsql-novice по дате отправления: