Thursday, February 3, 2011

How to see non printable special and control characters in Unix

Sometimes while troubleshooting data issues I want to see non printable characters on the stdin.
Following is how to do that

1. Create a file with non printable characters
     echo -e "Quick brown fox\tjumped over lazy\0002dog"  > test

2. View the file
     cat test
You will see
Quick brown fox jumped over lazydog

3. Now to see non printable speical characters use command od as
      od -c test
Output will be
0000000   Q   u   i   c   k       b   r   o   w   n       f   o   x  \t
0000020   j   u   m   p   e   d       o   v   e   r       l   a   z   y
0000040 002   d   o   g  \n
0000045


No comments:

Post a Comment