How to cleanse unprintable windows characters on linux

sometimes unwanted ^M characters show up in linux files that have been copied over from windows .

The cleanse the files follow this.

if you have windows unprintable characters in a file use the following for preview
# tr -cd '\11\12\40-\176' < <filename>
# tr -cd '\11\12\40-\176' <

# cat –vet <filename>

To cleanse and save the file
# tr -cd '\11\12\40-\176' < >

To see unprintable characters in a vi or vim session use the list option. so in vi or vim
:set list


Please sign in to leave a comment.