blob: f91d84dc4c8ebc8273299b1198a0bc0a558b8037 (
plain)
1
2
3
4
5
6
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") }
|