I'm looking to output the characters between two positions A and B that are specified by the preceding line. Per pair, the two lines are equal in length, but among pairs the lengths can vary. Is there an efficient way (huge file sizes) to do it with grep
, sed
, or awk
?
Example file:
xxxxxxAxxxxxxBxxxxxx
1234567890MNOPQRSTUV
xxAxxxxxxxxxxxxxxBxxxxxx
1234567890MNOPQRSTUVWXYZ
…
I would like to obtain the output:
7890MNOP
34567890MNOPQRST
…
Best Answer
Using
awk
:Explanation: read in man
awk
: