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

File: gawk.info,  Node: Extension Sample Rev2way,  Next: Extension Sample Read write array,  Prev: Extension Sample Revout,  Up: Extension Samples

17.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
         close(cmd)
     }

   The output from this program is: 'cinap t'nod'.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.