tr
Translate or delete characters
Lowercase to Uppercase
echo {a..z}|xargs -n1|tr '[:lower:]' '[:upper:]'|sed 's/$/*/g'
Uppercase to Lowercase
echo {a..z}|xargs -n1|tr '[:upper:]' '[:lower:]'|sed 's/$/*/g'
Replace all lower case t with a uppercase ´T`
echo "this is a test" | tr 't' 'T'
Delete all instances of lower case t
echo "Tongue tied and twisted just an earth bound misfit" | tr -d t
Remove/Delete all instances of the letter t lowercase or uppercase
echo "Tongue tied and twisted just an earth bound misfit" | tr -d 'Tt'
Delete all instances of letters in the range of “a-j`:
echo "Tongue tied and twisted just an earth bound misfit" | tr -d 'a-j'
You can also use interpreted sequences, for example, to delete all uppercase letters
echo "Tongue tied and twisted just an earth bound misfit" | tr -d [:upper:]
You can also use ranges here as well. As an extreme example, here we will replace letters a-d with the numbers 1-4. This effectively maps a to 1, b to 2, c to 3, and d to 4
echo "Tongue tied and twisted just an earth bound misfit" | tr 'a-d' '1-4'
Replace anything that is NOT a letter “awith a letter “x
echo "Tongue tied and twisted just an earth bound misfit" | tr -c "a" "x"
Replace anything that is NOT a digit with an “X`
echo "1 mississippi 2 mississippi 3 mississippi" | tr -c [:digit:] X
Delete anything that is NOT a digit
echo "1 Mississippi 2 Mississippi 3 Mississippi" | tr -cd [0-9]
Matrikx Style
tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"
Resource(s)