tr command tutorial
tr [OPTION] SET1 [SET2]
cat content | tr “[:lower:]” “[:upper:]”
complements the set of characters in string.i.e., operations apply to characters not in the given set
echo "my ID is 73535" | tr -cd [:digit:]
delete characters in the first set from the output.
echo "Welcome To GeeksforGeeks" | tr -d 'w'
elcome To GeeksforGeeks
replaces repeated characters listed in the set1 with single occurrence
echo "Welcome To GeeksforGeeks" | tr -s [:space:] ' '
Welcome To GeeksforGeeks
first truncates set1 to the length of set2, then do replacement
echo 'the cellar is the safest place' | tr -t abcdefghijklmn 123
the 3ell1r is the s1fest pl13e
-t, character in
set1 that is after set2 will repeat the last character in
t33 33331r 3s t33 s133st p3133