Below you will find pages that utilize the taxonomy term “tr”
April 25, 2017
tr - translate or delete characters
purpose the tr command is for “translating” (replacing or deleting) characters in a string. Accepts input from stdin, and puts output on stdout. I am bold about characters because it’s not got a way to specify that you want to replace one string with another string (use sed for that).
examples single character replacement The basic usage on tr is to just replace one character with another. It’s case-sensitive:
echo "aAbBcCdD1234" | tr 1 R aAbBcCdDR234 #only the '1' was replaced with 'R' character set replacement One can specify a set of characters to be replaced by a set of others: