bash - using sed how to put space after numbers in a big string -
This question was asked in an interview. I can not answer! So here is some help to understand logic. This is how the command is used to get the following result when looking at a string "1abc2abcd3efghi10z11jkl100pqrs" string -
"1 abc 2 abcd 3 efghi 10
already Thank you.
Here's another - - yet simple - the way to think about it:
echo "1abc2abcd3efghi10z11jkl100pqrs" | \ Sed -r '/ / ([0- 9]) ([a-zA-Z]) / \ 1 \ 2 / g; / S ([a- ZA-Z]) ([0- 9]) / \ 1 \ 2 / g \ '
- Add a white space between the numeric string; the letter-numeral string < / Li> >
(< Ul>
Comments
Post a Comment