Thursday, October 15, 2009

Removing ^M (Ctrl +M) characters

Time to time we have to delete ^M charaters in *nix from a files, here is a simple script which will do it fast.

# To remove ctrl+M character from txt file in solaris
# Date: 2009-02-06

if [ -f $1 ]
tr -d '\15' < $1 >newname
mv newname $1

Script first remove the ^M characters and then move the file to same filename.

No comments:

Post a Comment