sed removing carriage return and newline

Hi,

I'm not very familiar with unix shell. I want to replace the combination of two carriage returns and one newline with one carriage return and one newline. I think the best way to do this is to use sed. I tried something like this:

sed -e "s#\[/r][/r][/n]#\[/r][/n]#g" file.txt

but it doesn't work.
Thanx in advance.

Greetings

Gina

Hi Gina,

Try something along these lines

sed 's!\\r\\r\\n!\\r\\n!g' file.txt
Hope this helps.

Matt.

sed uses $ as the end of line marker (i.e newline), so use something like...

$ CR=`printf "\r"`
$ printf "\r\r\n" | sed "s/$CR$CR$/$CR/g" | od -hc
0000000    0d0a
         \r  \n
0000002