diff options
Diffstat (limited to 'test/reverse.awk')
-rw-r--r-- | test/reverse.awk | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/reverse.awk b/test/reverse.awk new file mode 100644 index 00000000..c6b2e299 --- /dev/null +++ b/test/reverse.awk @@ -0,0 +1,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) +} |