how to use tr in linux code example
Example 1: linux tr in file
Just use tr command as follows to replace a delimiter:
tr '(' '[' file.txt #replaces parenthesis '(' for brackets '['
tr '()' '[]' file.xt #respectively replaces '(' for '[' and ')' for ']'
Example 2: tr command
tr command replaces input chars for respective translated chars. Example:
echo 'dcba' > file.txt
tr 'abcd' '1234' < file.txt
4321