SED - how to remove blank spaces
Hi all,
I'm having a problem trying to erase blank space between characters. I have the following in a file:
sc_signal< bool> inTicks_vl;
sc_signal< bool> inTicks_vr;
sc_signal< bool > inTicks_hl;
sc_signal< bool > inTicks_hr;
There I have normal spaces and tabs between the characters. So I tried to use:
sed -i 's/<\ *\([^ ]*\)\ *>\ *\([^ ]*\);/<\1>\2;/' file
sed -i 's/<\t *\([^ ]*\)\t *>\t *\([^ ]*\);/<\1>\2;/' file
So that my file would look like this (no spaces in between the words):
sc_signal<bool>inTicks_vl;
sc_signal<bool>inTicks_vr;
sc_signal<bool>inTicks_hl;
sc_signal<bool>inTicks_hr;
But the problem is that those commands just delete all tabs or all spaces until they find something else. That means, if in one line I have:
Word<SpaceTabTabSpaceSpaceWordSpaceTabSpace>TabSpaceTabWord;
The result is:
Word<SpaceSpaceWordSpace>SpaceTabWord;
Does somebody know a way to make it look like:
Word<Word>Word; at the end?
|