tr
tr is a command in Unix-like operating systems. It is an abbreviation of translate or transliterate, indicating its operation of replacing or removing specific characters in its input data set.[1]
- GNU Coreutils [EN] @ Fedora Package
- GNU Coreutils [EN] @ Homebrew Formula
Documentation
- tr [EN] @ GNU Coreutils Manual
- man 1 'tr' [EN]
Syntax
tr [PARAMETER ...] [SET ...]
Parameters
- -c, -C, --complement
- Use the complement of SET1.
- -d, --delete
- Delete characters in SET1, do not translate.
Examples
- Translate the text to upper-case.
tr '[:lower:]' '[:upper:]' <<<'Example Text'
- Get calender week
date '+KW %-V' | tr -d '\n'
Output:
KW 8