There's also "dos2unix", which comes with most Linux/Unix systems I've seen in the last 10 years:
dos2unix -n dos_file new_unix_file
lazy
sed is made for these kind of things...
> sed -i "s/r//" file.txt
If you want to keep a backup of the file just specify an extension.
> sed -i.bak "s/r//" file.txt
Above line will create file.txt.bak as a copy of the original file.
Anonymous
<ul id="quote"><h6>Doug Merritt wrote:</h6>Bad advice, doesn't work! This says delete (-d) all sequences of the form "1532"...that's wrong for two reasons.
First, "32" is a typo, that's just a random control character. "12" is the correct octal escape for newline (and 15 is carriage return). </ul>
15 is r. Yes, you do want to delete all r's.
32 is CTRL-Z. DOS text files have an EOF byte: 0x1a or 32 or ^Z. This also removes that character. Yes, you do want to delete all ^Z's.
So this is good advice and does work. Did you try it?
I do agree with the other poster who said to use -i to edit the file in place, though.
Anonymous
Running the command:
tr -d '1532' < teste.f > teste1.f
Cleans up my ctrl-m's but not the final ctrl-z. Anyone would happen to know why?