Help On Filtering ^M's Out
You may have problems with files you transfer over to Unix from a
"Wintel" system. Specifically, you may get files with a "^M" at
the end of each line. You can (and should) filter these files
with the following commands:
cat myfile | col -b > temp
mv temp myfile
Here I've assumed that the name of the file you want to filter is
"myfile" and I've also assumed that you do not have a previously
existing file named "temp." When you do this operation,
naturally, you will need to substitute the actual name of the
file you want to filter and the temporary file name you want to
use.
A few more points:
- If you transfer files with ftp in ascii mode, I don't think you
will have any such problems.
- There have been cases where extra ^M characters have caused
programs to fail to compile.
- Regardless of whether ^M's make the program unworkable, their
presence certainly does affect the neatness of the work.
Neatness counts much more than you may realize. "Noise" in
source code makes it more difficult to read and understand, and
this can have very serious consequences.
- Be aware that instructors may decrease your grades on assignments
if you turn in unfiltered files.
- Typescript files created with the Unix "script" command also need
to be filtered this way.
- If you understand how to make and use shell scripts, consider
creating a script like this to filter your files:
cat $1 |col -b > temp
mv temp $1