NetBSD/gnu/dist/gawk/awklib/eg/misc/findpat.sh

11 lines
224 B
Bash

awk '{
if ($1 == "FIND")
regex = $2
else {
where = match($0, regex)
if (where != 0)
print "Match of", regex, "found at", \
where, "in", $0
}
}'