I am looking for a regular expression to remove a single character word. I do not mind using perl, awk, sedor bashbuilt-in modules.
Test case:
$ echo "a b c d e f g h ijkl m n opqrst u v" | $COMMAND
Required Conclusion:
ijkl opqrst
What I have tried so far:
$ echo "a b c d e f g h ijkl m n opqrst u v" | sed 's/ . //g'
acegijkln opqrstv
I suppose that:
a not deleted because there is no space before itcit remains that after removal bthere are no more spaces in front of it- etc.
Attempt number 2:
$ echo "a b c d e f g h ijkl m n opqrst u v" | sed 's/\w.\w//g'
s v
Here I do not understand what is happening.
Any help + explanation is appreciated, I want to find out.
source
share