UNIT="CCC62"
echo $UNIT |
gawk '{match($0,/(.){4}/,a)}{if (a[1] == 7 || a[1] == 6) print $0}'
the above yields expected/wanted results if the variable's 4th character is "6" or "7" then the line is printed, but is there a way of putting the variable in gawk's code and get same results ? and is there a smarter way of doing the following only using gawk that is?