many thanks for awk uppercase solutions(was: cascading pipes in awk)

Scot Mcintosh psm at manta.NOSC.MIL
Sat May 27 07:20:50 AEST 1989


Thnaks to all who responded to my query about cascading pipes in awk (which
soon became a discussion of how to convert text to uppercase in awk). The
following submission is my favorite, because it's applicable to any
kind of filter, not just tr. It also nicely illustrates the use of some
awk features that were a little hazy to me even after reading the
book.

BEGIN {
       outcmd = "tr '[a-z]' '[A-Z]' >foobar"
      }

      {
       print $1 | outcmd
      }

END   {
       close(outcmd)
       while (getline x < "foobar")
           print x;
      }



More information about the Comp.unix.questions mailing list