Discussion:
Problem with sed converting convert DOS newlines (CR/LF) to Unix format (sed version 3.02+))
Aachen Panoramen
2012-11-27 08:43:09 UTC
Permalink
Hello,


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.


Can anyone help me with this problem?
Thanks,
Andreas.
Davide Brini
2012-11-27 09:26:59 UTC
Permalink
On Tue, 27 Nov 2012 00:43:09 -0800 (PST), Aachen Panoramen
Post by Aachen Panoramen
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.
--
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.
Loading...