August 24, 2006

[shell] removing ^M : Dos text to unix

Filed under: Programming — HanaDaddy @ 11:52 pm

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

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

 

43 queries. 0.425 seconds. Powered by WordPress