aboutsummaryrefslogtreecommitdiffstats
path: root/awklib/eg/misc/findpat.awk
diff options
context:
space:
mode:
Diffstat (limited to 'awklib/eg/misc/findpat.awk')
-rw-r--r--awklib/eg/misc/findpat.awk10
1 files changed, 10 insertions, 0 deletions
diff --git a/awklib/eg/misc/findpat.awk b/awklib/eg/misc/findpat.awk
new file mode 100644
index 00000000..e9bef9ea
--- /dev/null
+++ b/awklib/eg/misc/findpat.awk
@@ -0,0 +1,10 @@
+{
+ if ($1 == "FIND")
+ regex = $2
+ else {
+ where = match($0, regex)
+ if (where != 0)
+ print "Match of", regex, "found at",
+ where, "in", $0
+ }
+}