Remove CRs

Jerry McAllister jerrymc at
Fri Jan 16 07:25:40 PST 2004

> FreeBSD-
> Please help, this is really important.  I was told that i could get rid 
> of the ^m symbols at the  end of the lines in my web page's html code 
> by using sed.  They said to execute sed "s//^m^m" index.html > 
> index.html or something like that.  This got rid of everything in the 
> file.  I really need this back, so any help would be greatly 
> appreciated.

I always use tr(1) to do that, eg say your Microsloth file is  myfile.txt
do this:
            tr -d "\r" < myfile.txt > myfile

Then you have a file called 'myfile' without the extra ^M-s which are
Carriage Return (CR) characters identified with the "\r" in the command.

You can also use dos2unix if you have it installed.  But tr comes
with FreeBSD by default.

Have fun,


> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"

More information about the freebsd-questions mailing list