Is it possible to have a regex that parses only a1bcdea1 from this line a1bcdea1ABCa1DEFa1 ?
a1bcdea1
a1bcdea1ABCa1DEFa1
This grep command does not work:
Here is a gnu awk solution using split function:
gnu awk
split
awk '(n = split($0, a, /[a-zA-Z]1/, b)) > 1 {print b[1] a[2] b[2]}' file
This awk command splits each line on regex /[a-zA-Z]1/ and stores split tokens in array a and delimiters in array b.
awk
/[a-zA-Z]1/
a
b