What I wanted was that if $8 field contains any of the values - 6100, 6110, 6200 - it should not be processed. But above pattern will match to 6210 as well and will reject it. What modification should I make in order for pattern not to select 6210 and all 6210s appear in the output?
will copy lines from $infile to output if and only if:
it is not the 1st line of the file,
the second field in the file does not start with "98", and
the eighth field in the file does not start with 6100, 6110, or 6200.
Note that item #3 in the list says "start with" (which is what your code was doing), but your English description said "contains". If you want "contains" instead of "starts with", change /^6(10|11|20)0/ to /6(10|11|20)0/ . If you want "is" instead of "starts with" or "contains", change $8 !~ /^6(10|11|20)0/ to $8 != /6(10|11|20)0/ .