gawk: Extension Sample Rev2way

1 
1 16.7.8 Two-Way I/O Example
1 --------------------------
1 
1 The 'revtwoway' extension adds a simple two-way processor that reverses
1 the characters in each line sent to it for reading back by the 'awk'
1 program.  Its main purpose is to show how to write a two-way processor,
1 although it may also be mildly amusing.  The following example shows how
1 to use it:
1 
1      @load "revtwoway"
1 
1      BEGIN {
1          cmd = "/magic/mirror"
1          print "don't panic" |& cmd
1          cmd |& getline result
1          print result
1          close(cmd)
1      }
1 
1    The output from this program is: 'cinap t'nod'.
1