I was trying to solve Grep regex to select only 10 character using awk. The question consists in a string XXXXXX[YYYYY--ZZZZZ and the OP wants to p
awk
XXXXXX[YYYYY--ZZZZZ
This with GNU Awk 3.1.7
echo "XXXXXXX[YYYYY--ZZZZ" | awk -F"--|[[]" '{print $2}' echo "XXXXXXX[YYYYYbbZZZZ" | awk -F"bb|[[]" '{print $2}'