I'm trying to remove all CLRF characters from a projects git repo. I'm writing a command to grep through the repo recursively to find instances. However, some of the 'hits' when opened in vim show very explicitly that there is ^M and yet others do not display these characters.
However, when running
file <filename without visual ^M>
It says
blah.java ASCII Java program text, with CRLF line terminators
and
od -cx <filename without visual ^M>
returns with \r\n peppered throughout.
I'm just interested why vim sometimes shows them and sometimes not.
EDIT:
I created a test text file and manually added ^M (ie ctrl V + ctrl M) and vim displayed those characters. Then I ran:
sed -i '' -e 's/\r//g' controlm.txt
And opened the file with vim and the visual ^M were gone, but od -cx still showed \r \n, however I then ran
sed -i '' -e 's/^M//g' controlm.txt
Then it removed not only the visual ^M in vim as well as I've confirmed that od -cx displays that \r \n are now just \n.