I have a string animal: dog
and I would like to tr
ansform to have just animal dog
(one space between).
e.g:
echo 'animal: dog' | tr ':' ' '
animal dog
There's 2 spaces above.
I tried making the replace an empty string but:
echo 'animal: dog' | tr ':' ''
tr: when not truncating set1, string2 must be non-empty
I can get desired outcome with -s but then I have to call tr twice. Is there a way to do it in a oner?
echo 'animal: dog' | tr ':' ' ' | tr -s ' '
animal dog