-->

Previous | Table of Contents | Next

Page 371

blank Horizontal whitespace
cntrl Control characters
digit Digits
graph Printable characters, not including space
lower Lowercase letters
print Printable characters, including space
punct Punctuation characters
space Horizontal or vertical whitespace
upper Uppercase letters
xdigit Hexadecimal digits

The way to invoke tr with one of these character classes is `[:classname:]'. To get rid of punctuation, use the punct class:


tr `[:punct:]' ` ` < ~/docs/ch16.doc |

tr `A-Z' `a-z' | tr -s ` ` | tr -d `\t\n' |

tr ` ` `\n' | sort | uniq -c | sort -rn

Here's some of the new output:




405 the

170 to

136 a

134 of

122 and

119 is

 80 files

 74 file

 72 in

 67 or

The numbers are different for some of the words because I have been running the commands and writing the chapter at the same time.

I could also have replaced `A-Z' and `a-z' with the upper and lower classes, but there is no real advantage to using the classes, and the ranges are much more illustrative of the process.

Summary

This chapter covers the four major GNU utilities packages and the major commands in each of these packages. As you have seen in the various examples, the real power of these packages lies in their capability to help the user break down complex tasks and solve them quickly.

Page 372

Previous | Table of Contents | Next