xref: /freebsd/contrib/one-true-awk/testdir/T.delete (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
1echo T.delete: misc tests of array deletion
2
3awk=${awk-../a.out}
4
5echo '1 2 3 4
61 2 3
71
8' >foo0
9echo '4 3 0
103 2 0
111 0 0
120 0 0' >foo2
13$awk '
14{	n = split($0, x)
15	delete x[1]
16	n1 = 0;	for (i in x) n1++
17	delete x;
18	n2 = 0; for (i in x) n2++
19	print n, n1, n2
20}' foo0 >foo1
21diff foo1 foo2 || echo 'BAD: T.delete (1)'
22