aboutsummaryrefslogtreecommitdiffstats
path: root/test/reverse.awk
blob: c6b2e2998f8581eb09872569cc46fd02d7598a1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#this program creates palindromic output - slightly modified from Gawk Manual
{
	rev($0, length)
}

function rev(str, len) {
	if (len == 0) {
		print " ", $0
		return
	}
	printf "%c", substr(str, len, 1)
	rev(str, len - 1)
}