manpagez: man pages & more
info gawk
Home | html | info | man

gawk: Extension Sample Rev2way

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