aboutsummaryrefslogtreecommitdiffstats
path: root/test/subback.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-06-14 21:18:36 +0300
committerArnold D. Robbins <arnold@skeeve.com>2016-06-14 21:18:36 +0300
commit6d5e4b7a4a8839d9406702ab30af62054078d3af (patch)
tree3a82a9f8318f093777454284a849512ff992bb5d /test/subback.awk
parente30696930a6335cee3cae0edad156bb4016ff993 (diff)
downloadegawk-6d5e4b7a4a8839d9406702ab30af62054078d3af.tar.gz
egawk-6d5e4b7a4a8839d9406702ab30af62054078d3af.tar.bz2
egawk-6d5e4b7a4a8839d9406702ab30af62054078d3af.zip
Fix long runs of backslashes in sub/gsub.
Diffstat (limited to 'test/subback.awk')
-rw-r--r--test/subback.awk16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/subback.awk b/test/subback.awk
new file mode 100644
index 00000000..d91513c1
--- /dev/null
+++ b/test/subback.awk
@@ -0,0 +1,16 @@
+BEGIN {
+ A[0] = "&"
+ for(i=1;i<=11;i++) {
+ A[i] = "\\" A[i-1]
+ }
+## A[] holds & \& \\& \\\& \\\\& ...
+}
+
+{
+ for(i=0; i <= 11 ; i++) {
+ x = $0
+ sub(/B/, A[i], x)
+ y = gensub(/B/, A[i], "1", $0)
+ print i, x, y
+ }
+}