I\'m trying to get a next field after matching field using awk.
Is there an option to do that or do I need to scan the record into array then check each field in array a
No need for slowing things down using a loop :)
awk -F1 '/FIELDB2/ {f=NR} f&&NR-1==f' RS="1" file VALUEB2
You can match the line, then loop over the fields for a match, and print the next record:
awk -F1 '/FIELDB2/ { for (x=1;x<=NF;x++) if ($x~"FIELDB2") print $(x+1) }'