How do you search for files containing DOS line endings (CRLF) with grep on Linux?

后端 未结 9 1223
栀梦
栀梦 2020-11-30 17:24

I want to search for files containing DOS line endings with grep on Linux. Something like this:

grep -IUr --color \'\\         


        
9条回答
  •  -上瘾入骨i
    2020-11-30 17:52

    You can use file command in unix. It gives you the character encoding of the file along with line terminators.

    $ file myfile
    myfile: ISO-8859 text, with CRLF line terminators
    $ file myfile | grep -ow CRLF
    CRLF  
    

提交回复
热议问题