[shell] removing ^M : Dos text to unix

[shell] removing ^M : Dos text to unix
0 votes, 0.00 avg. rating (0% score)
tr -d '\015' < inputfile > outputfile

Detecting ^M (\r\n)

Note that “^M” is “Cntrl+V and Enter” Key

#!/bin/sh
 
if grep "^M" $1 > /dev/null
then
   echo $1 contains DOS Carriage Return
fi

Leave a Reply

Your email address will not be published. Required fields are marked *