1# s[] is array of match strings 2# r[] is array of match patterns 3 4NR > lines { next } 5 6{ 7 if (s[NR]) { 8 if ($0 == s[NR]) 9 next 10 print "Line " NR " does not match expected string: " s[NR] 11 } else { 12 if (match($0, r[NR])) 13 next 14 print "Line " NR " does not match expected pattern: " r[NR] 15 } 16 17 fail = 1 18} 19 20END { 21 if (fail == 0 && NR != lines) { 22 fail = 1 23 print "Expected " lines " lines, found " NR " line(s)." 24 } 25 exit fail 26} 27