aboutsummaryrefslogtreecommitdiffstats
path: root/test/subback.awk
blob: d91513c14d9ba181b101dd9f2f46880733dacb08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
    }
}