Squashing spaces
If we want to remove extra spaces in a text like this:
This is some interesting text.
You could be Clinica Stomatologie Bucuresti curs valutar crama lechinta Psiholog Cluj tempted to use sed, but there is a simpler way using tr
tr -s ' '
And we end up with:
This is some interesting text.
With tr you can also delete characters instead of compressing them. Let’s say we wanted to get rid of the vowels.
tr -d 'aeiou'
We get:
Ths s sm ntrstng txt.