[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When given just the `--delete' (`-d') option, tr
removes any input characters that are in set1.
When given just the `--squeeze-repeats' (`-s') option,
tr
replaces each input sequence of a repeated character that
is in set1 with a single occurrence of that character.
When given both `--delete' and `--squeeze-repeats', tr
first performs any deletions using set1, then squeezes repeats
from any remaining characters using set2.
The `--squeeze-repeats' option may also be used when translating,
in which case tr
first performs translation, then squeezes
repeats from any remaining characters using set2.
Here are some examples to illustrate various combinations of options:
tr -d '\000' |
tr -cs 'a-zA-Z0-9' '[\n*]' |
tr -s '\n' |
uniq
with the `-d' option to print out only the words
that were adjacent duplicates.
#!/bin/sh cat "$@" \ | tr -s '[:punct:][:blank:]' '\n' \ | tr '[:upper:]' '[:lower:]' \ | uniq -d |