_                    _
  ___ | |__   __ _ _______ | |_
 / _ \| '_ \ / _` |_  / _ \| __|
| (_) | | | | (_| |/ / (_) | |_
 \___/|_| |_|\__,_/___\___/ \__|

trtranslate characters

-d delete characters
-s squeeze repeats

Characters can be specified as a character, class, range.

class : [:class:] :alpha, alnum, digit, cntrl, upper, lower, print, space, punct.
range : aA0-zZ9 (the beginning of the range is excluded).

back to top

$ echo "hello" | tr "l" "m"
hemmo

echo "hello" | tr 'e' '\n'
h
llo
echo 'hello' | tr 'l' '\t'
he              o

echo 'hello' | tr 'h-l' 'a-d'
aeddo

echo '1.hello\n2.goodbye' | tr '[:digit:]' 'a-c'
b.hello
c.goodbye

back to top

back to top

text_manipulation

- OpenBSD manpages: tr(1)

back to top

ohazot | about | ohazot.com <admin@ohazot.com>

OpenBSD 7.7 linux| Created:2025-10-03|Updated:2025-10-21|