Strip ^M with sed #2 (was Re: [plug] Netscape Default Profile...)

Peter Wright pete at
Tue Feb 22 10:56:40 WST 2000

On Tue, Feb 22, 2000 at 10:49:51AM +0800, Steve Grasso wrote:
> >BTW: Any idea how I use sed to strip out ^M's (artefact of DOS txt files) from
> >a text file?
> >[snip]
> >Quote from the "sed" manpage about Regular Expressions:
> >        [XXX FIXME: more needs to be  said.   At  the
> >        very   least,   a  reference  to  another  document  which
> >        describes what is supported should be given.]
> Having had a bit of a play, it would appear that neither \r
> (carriage return) nor ^M  are supported in sed regex's

perl -p -i -e 's/\r//' file*

> (any reason you can't use a perl one-liner Trevor?)

Nope. :)

> Steve


"Beware of bugs in the above code; I have only proved
it correct, not tried it." -- Donald Knuth

More information about the plug mailing list