given a text, is there a program that can detect what the new line character is, the Windows, Mac, or Linux one?
Eg, the following text is shown by less
memor:^M^Mis storage directly accessible by CPU^M^MThe term "memory"
is often (but not always) associated with addressable semiconductor
memory, i.e. integrated circuits consisting of silicon-based
transistors.^MThe semiconductor memory i s organized into ^Mmemory
cells
I thought ^M is the new line character under Mac.
But in emacs, I searched by Ctrl-q Ctrl-m and found nothing.
Thanks.
Best Answer
file
will report on line endings for text files. If you runfile
on an ASCII Unix/Linux/OSX text file, for example, it will report simply:If, however the file has DOS/Windows line-endings, it will instead report:
Up to OS 9, Macs used CR as the line ending. When presented with such a file,
file
will report:With OSX, Macs converted to standard Unix line endings.