Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!kddlab!titcca!kogwy!wnoc-tyo-news!dclsic!sjc!spider!leia!harkcom From: harkcom@potato.pa.Yokogawa.CO.JP (Alton Harkcom) Newsgroups: comp.unix.questions Subject: awk gacks with grep Message-ID: Date: 7 Jul 90 00:15:41 GMT Sender: news@leia.pa.yokogawa.co.jp Distribution: comp Organization: Yokogawa Electric Corporation, Tokyo, Japan. Lines: 57 I don't understand... I used a textbook example from Kernighan and Pike "The UNIX Programming Environment" and then hit it with grep and it bellied up... #sentry program to let me know when somebody logs on or off #from page 147 "The UNIX Programming Environment" by Kernighan and Pike # watchwho: watch who logs in and out #PATH=/bin:/usr/bin # I don't need it new=/tmp/wwho1.$$ old=/tmp/wwho2.$$ >$old # create empty file while : # loop forever do who >$new diff $old $new mv $new $old sleep 60 done | awk '/>/ && !/harkcom/ { $1 = "in: "; print } // && !/harkcom/ { $1 = "in: "; print } / /tmp/sentry.tmp" and let it run while I rlogged in and out on another terminal for a while. Then I interrupted sentry and looked at /tmp/sentry.tmp. It was empty... Is there something about the way that awk buffers that I need to know? I fixed the problem by adding the awk script to skip my name but I still want to know ?why? Help... -- --harkcom@potato.pa.yokogawa.co.jp