How do I list all the files in Solaris which are ^M chars in it?

How do I list all the files in Solaris which are ^M chars in it?

Tried the below, which didnt help

find . -type f -name "*" -exec file "{}" \; | grep -c CRLF

find . | xargs grep -l "\^M"

Thank you,
Sunil Kumar

In all likelihood, you aren't looking for the two character sequence ^M . Instead, you are looking for the carriage return control character that is entered on most keyboards by holding down the control key (sometimes labeled CTL or CNTRL ) while pressing and releasing the m key. The following command on a Solaris 10 or 11 system should find and give you a list of the names of all regular files in and under your home directory that contain a carriage return character:

find $HOME -type f -exec /usr/xpg4/bin/grep -Fl "$(printf '\r')" '{}' +
1 Like

you can press the Ctrl key and "v" together , then press "m"

Excellent, working fine. Thanks a lot for timely help!