Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 1
    Do you mean you literally write CRLF as 4 characters C, R, L and F? Commented Dec 3, 2015 at 3:19
  • 7
    Do you also mean that grep can take CR and LF just like that? Commented Dec 3, 2015 at 3:19
  • @bodacydo It's explained in the answer he links to, and now also in Scott's edit of BertS' answer here unix.stackexchange.com/a/79708/59699 . Commented Dec 3, 2015 at 5:14
  • 2
    @bodacydo stackoverflow.com/questions/73833/… says that find ... -exec file ... | grep CRLF for a file with DOS line endings (i.e. bytes 0D 0A) "will get you something like: ./1/dos1.txt: ASCII text, with CRLF line terminators As you can see this contains the actual string CRLF and therefore is matched by grep looking for the simple string CRLF. Commented Dec 4, 2015 at 8:40
  • 1
    This solution isn't very complete, it will miss a lot of text files. Because file doesn't report line endings on all types of text files. For example, for json files it just says JSON data and for svg files it says SVG Scalable Vector Graphics image. In both cases it does not include any information about line endings. Commented Mar 5, 2024 at 12:07