PolyAwk - AWK question

Brandon S. Allbery allbery at ncoast.ORG
Wed May 10 10:11:56 AEST 1989


As quoted from <17886 at cup.portal.com> by MJB at cup.portal.com (Martin J Brown-Jr):
+---------------
| awk '$0 !~ /Command:*/ { print $0 >"d:foo" } "d:file.txt"'
+---------------

Was this the *exact* quoting?

By putting the file name inside the single quotes, you made it part of the
awk program, *not* an input filename.  The result is that it's reading from
the keyboard so it can copy lines not containing "Command" (if this isn't
what you wanted, check that regexp!) to "d:foo", and also attempting to
apply the string "d:file.txt" as a condition.  That last might be handled
either as a test for string equality against $0, or as an always "true"
depending on how they did it.

++Brandon
-- 
Brandon S. Allbery, moderator of comp.sources.misc	     allbery at ncoast.org
uunet!hal.cwru.edu!ncoast!allbery		    ncoast!allbery at hal.cwru.edu
      Send comp.sources.misc submissions to comp-sources-misc@<backbone>
NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser



More information about the Comp.unix.questions mailing list