summaryrefslogtreecommitdiffstats
path: root/contrib/awk/awklib/eg/misc/findpat.sh
blob: 397103247a1e58e9b4b5120e259a8eee76815dbf (plain)
1
2
3
4
5
6
7
8
9
10
awk '{
       if ($1 == "FIND")
         regex = $2
       else {
         where = match($0, regex)
         if (where != 0)
           print "Match of", regex, "found at", \
                     where, "in", $0
       }
}'
OpenPOWER on IntegriCloud