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

后端 未结 9 1224
栀梦
栀梦 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条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 18:03

    The query was search... I have a similar issue... somebody submitted mixed line endings into the version control, so now we have a bunch of files with 0x0d 0x0d 0x0a line endings. Note that

    grep -P '\x0d\x0a'
    

    finds all lines, whereas

    grep -P '\x0d\x0d\x0a'
    

    and

    grep -P '\x0d\x0d'
    

    finds no lines so there may be something "else" going on inside grep when it comes to line ending patterns... unfortunately for me!

提交回复
热议问题