Thursday, August 7, 2008

Script to replace ^M characters in unix

#!/bin/sh
if [ $# -eq 0 ]
then
echo
echo "This script will replace the ^M line breaks from dos"
echo "Usage replace "
echo
exit 1
fi
tr -s "\r" "\n" < $1 >$1.tmp
rm $1
mv $1.tmp $1
chmod u+x $1


Note: Don't forget to remove ^M characters from this script first

No comments:

Post a Comment