display | more...
This is how you type a CR, the macintosh line break, in *n?x operating systems. In perl or c, this character is represented as \r.

Running a Macintosh file through less will result in all the linebreaks appearing as ^Ms. Running a Windows file through less will result in a ^M at the end of each line. (Mac uses CR alone, Windows uses CR and LF at once, UNIXlike uses LF alone.) If that annoys you, you can use the following simple inefficient perl oneliner as a piped intermediary:

cat "file with windows or macintosh linebreaks" | perl -e '$/="\r";while(<>){s/\r$//;print($_,(/^\n/?"":"\n"));}' | less

Log in or register to write something here or to contact authors.