If we want to remove extra spaces in a text like this:
|
1 |
This is some interesting text. |
You could be tempted to use sed, but there is a simpler way using tr
|
1 |
tr -s ' ' |
And we end up with:
|
1 |
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.
|
1 |
tr -d 'aeiou' |
We get:
|
1 |
Ths s sm ntrstng txt. |