| previous | contents | up | next |
sort inputfile
To specify an output filename, you could use the -o
option, which would look like this:
sort -o sortedfile inputfile
To sort in reverse order use the -r flag. To check to
see if a file is sorted, use the -c flag. Consult the
man page for additional options.
/usr/dict/words) to spell check the file you specify.
The program will output each word that it cannot find in its
dictionary. If you would like to check the spelling of a single word,
you can use the construction:
echo "wordtobechecked" | spell
If the word you entered is returned at the command line then spell thinks it is misspelled.
example% cat uniq.test
This is a test.
This is a test.
TEST.
Computer.
TEST.
TEST.
uniq with no arguments:
example% uniq uniq.test
This is a test.
TEST.
Computer.
TEST.
The -d flag will print those entries that had adjacent
lines repeated.
example% uniq -d uniq.test
This is a test.
TEST.
Finally we can see that the -c option counts the
occurrences of each line:
example% uniq -c uniq.test
2 This is a test.
1 TEST.
1 Computer.
2 TEST.
echo a | tr a z
sends the character a into the tr program which changes the letter a into the letter z.
Using the -d flag, you can delete the characters that you
specify. An example might look like this:
example%echo "look lidke thisz" | tr -d dz
look like this
A common use of tr is to convert lowercase characters to uppercase. This can be done in many ways. Here are three of them:
tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
tr a-z A-Z
tr '[:lower:]' '[:upper:]'
| previous | contents | up | next |