Manual / tr
tr(1)
| TR(1) | General Commands Manual | TR(1) |
NAME
tr - transliterate
SYNOPSIS
tr [-cds] string1 [string2]
DESCRIPTION
Tr copies the standard input to the standard output with substitution or deletion of selected characters. Input characters found in string1 are mapped into the corresponding characters of string2. A short string2 is extended by repeating its last character.
- -c
- Complement string1 over all 256 byte values.
- -d
- Delete input characters in string1 instead of translating.
- -s
- Squeeze repeated output characters in string2 to one copy. If string2 is absent, use string1 as the squeeze set.
Only translation requires two strings; deletion or squeezing alone can use one. An ascending range such as a-z abbreviates successive characters. Unlike V6 tr, ranges are not bracketed. Quote the strings to protect them from the shell:
tr a-z A-Z <input >output
FILES
/usr/man/TR this page
SEE ALSO
DIAGNOSTICS
Exit status is 0 on completion, 2 for usage errors.
BUGS
No backslash escapes, character classes or repetition notation are implemented. Shell operands are high-bit maux text; they do not name the corresponding low-ASCII bytes. Input bytes are otherwise passed unchanged.
| September 19, 2026 | maux |