
Originally Posted by
jbrown96
^ is a special character. It means "lock to beginning of line." Try this instead
Code:
sed s/\^M//g $filename > $filename
Edit: That will destructively overwrite the original file. You may want to try outputting to another file to make sure it works properly first.
Now I get the following error:
Code:
./rename.sh: line 3: syntax error near unexpected token `sed'
./rename.sh: line 3: `sed s/\^M//g $fileName > $fileName'
File looks like this:
Code:
#/bin/ksh
for fileName in $(ls *.txt): do
sed s/\^M//g $fileName > $fileName
done
I'm testing this in a subdirectory figuring a few attempts will destroy my files 
Thanks!
Bookmarks