What OS? Most unix systems have some sort of program to do this job. Solaris has dos2unix, HP-UX has dos2ux, most of the other systems should have dos2unix too. Use these.
NAME
dos2unix - convert text file from DOS format to ISO format
SYNOPSIS
dos2unix [-ascii] [-iso] [-7] [-437 | -850 | -860 | -863 |
-865] originalfile convertedfile
1K$ /usr/bin/dos2unix tmp.txt > tmp1.txt
could not open /dev/kbd to get keyboard type US keyboard assumed
could not get keyboard type US keyboard assumed
I am not sure what this keyboard type thing is....
Is there any other faster way to strip off ^M characters? Right now, I am using sed and tr...
You do not have to worry about that. That is just a warning. dos2unix will assume that you have a US style keyboard and go ahead with the file conversion to unix format. And since you are using Solaris, you do not need to worry about that '>' redirection stuff either.
dos2unix filename filename
This will take input from the filename specified and provide the output in the same file.