Let's explain what this is about: in UNIX, ENTER is translated as chr(13) (ASCII-code of carriage return), in DOS (Windows) ENTER is translated as chr(13)+chr(10) (carriage return combined with newline character). When you open a Windows textfile in UNIX, you see that chr(10) character (which you don't want). The mentioned dos2unix command searches for that chr(13)+chr(10) and removes the chr(10) characters. – Dominique
2
Arkadiusz Drabczyk
On
Use find with sed.
With GNU sed:
find . -name "*ctl" -type f -exec sed -i 's,^M,,' "{}" \;
With BSD sed:
find . -name "*ctl" -type f -exec sed -i '' -e 's,^M,,' "{}" \;
^M in sed argument is a literal Control-M, not ASCII ^ followed M. Press Control-v and then M to enter it.
dos2unix was born to solve this problem.
You can locate all the target files by find or whatever program, then
Background of this problem (by Dominique )
Let's explain what this is about: in UNIX, ENTER is translated as chr(13) (ASCII-code of carriage return), in DOS (Windows) ENTER is translated as chr(13)+chr(10) (carriage return combined with newline character). When you open a Windows textfile in UNIX, you see that chr(10) character (which you don't want). The mentioned dos2unix command searches for that chr(13)+chr(10) and removes the chr(10) characters. – Dominique