By Alvin Alexander. Last updated: March 25, 2021
I just ran into a need to see what non-printable (non-visible? non-ASCII?) characters were embedded in a text file in a Unix system, when I remembered this old sed
command:
sed -n 'l' myfile.txt
Note that the character in that sed
command is a lower-case letter "L", and not the number one ("1").
This command shows the contents of your file, and displays some of the non-printable characters with the octal values. On some systems tab characters may also be shown as ">" characters.
Similar to vi binary mode
This is similar to using the cat
command, except for the handling of the non-printing characters. You can also see something similar with the vi "binary mode" argument, like this:
vi -b myfile.txt