The cat
-v
option (25.7
)
shows non-printable characters in a printable way.
cat
has two options for displaying white space in a line.
If you use the -t
option with -v
, TAB
characters are shown as
^I
.
The -e
option combined with -v
marks the end of each line
with a $
character.
Some versions of cat
don't require the -v
with those options.
Let's compare a one-line file without and with the -t -e
(which
have to be typed separately, by the way; -te
won't work):
% cat afile
This is a one-line file - boring, eh?
% cat -v -t -e afile
ThiS^Hs is^Ia one-line file^I- boring, eh? $
Although you can't tell it from plain cat
, there's a backspace
(CTRL-h) before the first s
, two TABs that take up only
one column of white space each, and seven spaces at the end of the line.
Knowing this can help you debug problems in printing and displaying files.
It's also a help for shell programmers who need to parse or sort the output
of other programs.