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>
Example
# tr -cd '\11\12\40-\176' < create-vlans.sh.txt
# tr -cd '\11\12\40-\176' < create-vlans.sh.txt
OR
# cat –vet <filename>
To cleanse and save the file
# tr -cd '\11\12\40-\176' < create-vlans.sh.txt > create-vlans.sh
To see unprintable characters in a vi or vim session use the list option. so in vi or vim
:set list
0 Comments