Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.questions Subject: Re: awk script Keywords: awk, ps, kill Message-ID: <1991Mar20.004422.6228@athena.mit.edu> Date: 20 Mar 91 00:44:22 GMT References: <1991Mar18.193118.17247@athena.mit.edu> <1991Mar19.171332.28055@colorado.edu> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 31 In article <1991Mar19.171332.28055@colorado.edu>, lewis@tramp.Colorado.EDU (LEWIS WILLIAM M JR) writes: |> WRONG! WRONG! WRONG! See page 10 of the nawk book or Section 2.2 (page 3) of |> the original Aho, Kernighan and Weinberger paper. The default action is |> to print $0. I am quite aware of the default action. But that wasn't what I was referring to. You should read a little bit more carefully before you tell someone that he is "WRONG! WRONG! WRONG!" The poster to which I was responding had this awk code: awk '{ $1 == ${ME} && $8 != "grep" $2 }' ` Now, as I said in my last posting in this thread, that is not valid because he has simply specified a field and expected awk to print it. This is different from the "default action" of printing $0, because the default action only takes place when there is no '{ ... }' for awk to evaluate. Don't believe me? Well, this (trivial example) doesn't work for me: ls -l | awk '{$2}' and this does: ls -l | awk '{print $2}' -- Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710