I use Linux. There is a pesky ^M (Windows cariage return) somewhere hidden in thousands of configuration files, and I have to find it, because it makes the server fail.
How do I find ^M among a directories hierarchy full of configuration files?
I think I can not enter ^M on the bash command line. But I have it in a text file that I called m.txt
Best Answer
Use
-r
for recursive search and$''
for c-style escape in Bash.Moreover, if you are sure it's a text file, then it should be safe to run
to remove all
\r
in a file.If you are using GNU
sed
,-i
will perform an in-place edit, so you won't need to write the file back: