Shell command tricks

Print a line character by character by showing whitespaces:

$ dmesg | sed -n -e '7p' | od -a
0000000    [  sp  sp  sp  sp  sp   1   ,   0   0   0   0   0   0   ]  sp
0000020    N   e   t   B   S   D  sp   9   .   0  sp   (   X   E   N   3
0000040    _   D   O   M   U   )  sp   #   0   :  sp   F   r   i  sp   F
0000060    e   b  sp   1   4  sp   0   0   :   0   6   :   2   8  sp   U
0000100    T   C  sp   2   0   2   0  nl                                
0000110

Match the lines with inconsistent indentations in a set of Python files:

$ find . -name "*.py" -print -exec grep -n -P "^\t" '{}' \;
./foo.py
./bar.py
42:             """This is a comment

Page top