Next: , Previous: , Up: Extension Samples   [Contents][Index]

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. It’s 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"

    cmd = "/magic/mirror"
    print "hello, world" |& cmd
    cmd |& getline result
    print result