Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Command line / shell variant' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Command line / shell variant
Authored by: osolemirnix on Jun 24, '02 11:33:38AM

Use the following shell command:

tr -d 'r' < file.txt > file.txt

This will remove the carriage returns (^M) and leave only the unix linefeeds.

Alternatively:

tr 'r' 'n' < file.txt > file.txt

This will replace the carriage returns (^M) with unix linefeeds.



[ Reply to This | # ]
Command line / shell variant
Authored by: dsewell on Feb 09, '06 10:01:54AM
tr -d 'r' < file.txt > file.txt
[...]
tr 'r' 'n' < file.txt > file.txt
The escaping backslashes got stripped in these examples. They should be:
tr -d '\r' < file.txt > file.txt
and
tr '\r' '\n' < file.txt > file.txt

---
David Sewell
White Hall, Virginia

[ Reply to This | # ]