Monday·29·November·2010
Useful but Unknown Unix Commandline Options of cat //at 14:04 //by abe
Yesterday in Harald König’s commandline talk at LinuxDay.at, I first heard of cat’s -e option, and noticed that cat has quite some interesting options. From the man page of cat:
- -A, --show-all
- equivalent to -vET
- -b, --number-nonblank
- number nonempty output lines
- -e
- equivalent to -vE
- -E, --show-ends
- display $ at end of each line
- -n, --number
- number all output lines
- -s, --squeeze-blank
- suppress repeated empty output lines
- -t
- equivalent to -vT
- -T, --show-tabs
- display TAB characters as ^I
- -v, --show-nonprinting
- use ^ and M- notation, except for LFD and TAB
Some examples made on an UTF-8 terminal:
user@host:demo $ cat bla ä ö ü ß abc user@host:demo $ cat -Ab bla 1 M-CM-$ M-CM-6 M-CM-<^IM-CM-^_ $ $ $ 2 abc$ user@host:demo $ cat -Ens bla 1 ä ö ü ß $ 2 $ 3 abc$ user@host:demo $
I hope this blog posting will reduce the percentage of “useless uses
of cat” by raising the amount of “useful uses of cat”. :-)
Tagged as: cat, GNU Coreutils, LinuxDay.at, nuggets, UTF-8, UUUCO, UUUT
// show without comments // write a comment