Re: Problem with sed converting convert DOS newlines (CR/LF) to Unix format (sed version 3.02+))

Davide Brini <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
On Tue, 27 Nov 2012 00:43:09 -0800 (PST), Aachen Panoramen
<[email protected]> wrote:

> I was using the following sed commands
> 
> s/.$//;
> s/^M$//;
> 
> 
> to replace DOS newlines (CR/LF) to Unix format in the following DOS text
> file (without --): --
> 
> Hello
> World
> Hello
> sed
> 
> --
> 
> With sed version 3.02 all was fine.
> Yesterday I updated to version 4.21 and this conversion doesn't work any
> more.
> 
> I tried other version too and found that it doesn't work any more since
> version 3.02.80.
> 
> The result of sed version 4.09 - 4.21 is:
> --
> 
> Hell
> Worl
> Hell
> se
> --
> 
> 
> The result of 3.02.80 and 4.06 is an empty file.

Perhaps try

s/\r$//

There are also dedicated utilities to do that (d2u, dos2unix).


-- 
D.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.