[__line/state] Make sure the index match is at the beginning

Without the == 1 all lines which contain --line as a substring match.  e.g. if
--line is "line" and the file contains the line "wrong line" this was considered
a match.
This commit is contained in:
Dennis Camera 2020-01-15 17:39:21 +01:00
parent 629d0795c8
commit 4cdb8aaa03

View file

@ -49,7 +49,7 @@ function _find(_text, _pattern) {
if (needle == "regex") { if (needle == "regex") {
return match(_text, _pattern) return match(_text, _pattern)
} else { } else {
return index(_text, _pattern) return index(_text, _pattern) == 1
} }
} }
BEGIN { BEGIN {