Replacing CR (\r) character with sed

Alexander Kriegisch Alexander at Kriegisch.name
Sat Feb 24 11:33:59 UTC 2007


I wonder how I can make sed work as a replacement for dos2unix. I do
know how to strip CR characters with tr or dos2unix, but I have reasons
to do it with sed besides just wanting to know how. Those reasons include
  - a bug in some tr versions making it strip special characters like
    German umlauts unintentionally (I have no influence on the version
    of tr used by other people) and
  - dos2unix not being part of our DSL router firmware mod's busybox
    (again, I have it, but many others don't).

I played around with several variants working in other sed versions,
tried to use basic regex mode as well as the -r switch for extended
regex syntax, but to no avail. BTW, I have not tried to put the sed
script into a file, as I want to use it as a command line argument.

Hints are most welcome.
Regards
-- 
Alexander Kriegisch



More information about the busybox mailing list