From: Padraig Brady (padraig at domain antefacto.com)
Date: Mon 15 Apr 2002 - 12:39:57 IST
To be complete:
sed 's/\x0D$//' # sed v1.5 only
is equivalent to:
tr -d '\r'
Also the opposite (unix2dos) can be
done with:
sed 's/$/^M/'
Note the unix2dos and dos2unix utilities
do other things like character set conversion.
Padraig.
Donncha O Caoimh wrote:
> While googling I found the following:
> http://www-h.eng.cam.ac.uk/help/tpl/unix/sed.html
>
> # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format
> sed 's/.$//' # assumes that all lines end with CR/LF
> sed 's/^M$//' # in bash/tcsh, press Ctrl-V then Ctrl-M
> sed 's/\x0D$//' # sed v1.5 only
>
> The last example is probably what you want.
>
> Donncha.
>
> Justin MacCarthy wrote:
>
>>On a similar note, what is the regex syntax for replacing a character by its
>>dec, hex or octal value
>>
>>e.g. change tab using decimal value 9.
>>
>>Justin
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:16:06 GMT