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

来源:互联网 发布:百度手机全家桶 知乎 编辑:程序博客网 时间:2024/05/22 04:35

Question:

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

Answer:

Use ctrl-V ctrl-M to enter a literal ctrl-M into your grep string. so:
grep -IUr --color "^M"  
will work - if the ^M there is a literal ctrl-M that you input as I suggested.
If you want the list of files, you want to add the -l option as well.
0 0