summaryrefslogtreecommitdiffstats
path: root/contrib/awk/test/gensub.awk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/awk/test/gensub.awk')
-rw-r--r--contrib/awk/test/gensub.awk7
1 files changed, 7 insertions, 0 deletions
diff --git a/contrib/awk/test/gensub.awk b/contrib/awk/test/gensub.awk
new file mode 100644
index 0000000..f91d84d
--- /dev/null
+++ b/contrib/awk/test/gensub.awk
@@ -0,0 +1,7 @@
+BEGIN { a = "this is a test of gawk"
+ b = gensub(/(this).*(test).*(gawk)/, "3 = <\\3>, 2 = <\\2>, 1 = <\\1>", 1, a)
+ print b
+}
+NR == 1 { print gensub(/b/, "BB", 2) }
+NR == 2 { print gensub(/c/, "CC", "global") }
+END { print gensub(/foo/, "bar", 1, "DON'T PANIC") }
OpenPOWER on IntegriCloud