Translate or delete characters.

Synopsis

tr [OPTION]... SET1 [SET2]

Description

Translate, squeeze, and/or delete characters from standard input, writing to standard output. Runs in the just-bash WASM shell inside SLICC.

Options

-d, --delete Delete characters in SET1.

-s, --squeeze-repeats Replace repeated characters in SET1 with a single character.

Character Classes

[] Uppercase letters A-Z.

[] Lowercase letters a-z.

[] Digits 0-9.

[] All letters.

[] Letters and digits.

[] Whitespace characters.

Examples

$ echo "hello" | tr 'a-z' 'A-Z'

Convert lowercase to uppercase.

$ echo "hello" | tr -d 'l'

Delete all occurrences of 'l'.

$ echo "hello world" | tr -s ' '

Squeeze repeated spaces to single space.

Notes

Operates on standard input only (no file arguments). Supports character ranges (a-z) and POSIX character classes.

See Also

sed, cut, awk