I have the following string:
E E E 11 5 E 3 4
I need to be able to strip all “E” characters that go before the numbers. So that the output would be like this:
11 5 E 3 4
The number of first “E” can be different, so it can be either “E E” or “E E E E” etc.
How can I do it with SED? If possible, with alternative shell utils.
This will replace all E’s and spaces before the first digit on a line, and that first digit, with the first digit.
The caveat would be that this doesn’t work on lines consisting only of E’s and spaces; I assumed from the wording that the removal is to be done only if there are numbers on the line. To support the case with only E’s simply use
s/^[E ]*//for the program.