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

00771g-Lukas lukas at ihlpf.ATT.COM
Thu Jun 1 04:04:02 AEST 1989


In article <821 at manta.NOSC.MIL> psm at manta.nosc.mil.UUCP (Scot Mcintosh) writes:
>BEGIN {
>       outcmd = "tr '[a-z]' '[A-Z]' >foobar"
>      }
>      {
>       print $1 | outcmd
>      }
>END   {
>       close(outcmd)
>       while (getline x < "foobar")
>           print x;
>      }

There is no real need to use file "foobar" (unless you want it). This
will also work, and save some complexity:

	BEGIN {
	       outcmd = "tr '[a-z]' '[A-Z]'"
	      }
	      {
	       print $1 | outcmd
	      }

If you wanted "foobar", you could tack " | tee foobar" on the end
of outcmd. To get even simpler, you could get rid of outcmd
completely with

	{ print $1 | "tr '[a-z]' '[A-Z]'" }
-- 

	John Lukas
	att!ihlpf!lukas
	312-510-6290



More information about the Comp.unix.questions mailing list