sed 's/^M//' $FN_TOP/out_HH1P/$1 > $2
Remove the 1st character if equal "M".
The input file name is the 1st shell argument ($1) and is in a directory named $FN_TOP/out_HH1P.
The ouput file is the 2nd argument and is in the current directory.
The shell variable FN_TOP must contains the name of a directory.
The ^M is a control character, and the above script is not the ideal way to treat this, since its escape status isn't always readable. (E.g., on some systems that character cannot even be typed, it has to be killed/yanked from within an editor.)
Here are two more predictable solutions:
tr -d "\015" $FN_TOP/out_HH1P/$1 > $2
-or-
dos2unix $FN_TOP/out_HH1P/$1 $2
BTW, the ^M (octal 015) is the DOS carriage return character accompanying the new line character (octal 012) in DOS files. Other OS (E.g., Unix) don't need this extra character and it shows up as a control character.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.