Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!rutgers!ames!ptsfa!nonvon!gilsys!mc68020 From: mc68020@gilsys.UUCP (Thomas J Keller) Newsgroups: comp.unix.questions Subject: awk pattern matching Message-ID: <1092@gilsys.UUCP> Date: Wed, 5-Aug-87 13:17:46 EDT Article-I.D.: gilsys.1092 Posted: Wed Aug 5 13:17:46 1987 Date-Received: Sat, 8-Aug-87 15:06:39 EDT Organization: Consequently Computers, Santa Rosa, Ca Lines: 37 Keywords: awk, patterns, matches I am attempting to write a small awk script which will scan my sulog file for attempts to su by any but a small list of user names. I can't seem to get the thing to work. Let's say I want to output any line from the sulog that indicates that a user other than root, news or me attempted to su. The format of the sulog records is: SU 08/05 09:30 + tty02 msi-root the 6th field (msi-root) is the field I want to match to. The basic pattern to be matched would be any of [root, news, me] with an explicit "-" and then *ANY* string of chars after that. I have tried: $6 !~ /[mnr][ceo][6wo][8st]*\-*/ { printf "%s\n", $0 } and: $6 !~ /me/ && $6 !~ /root/ && $6 !~ /news/ with no success. Naturally, the WONDERFUL error messages from awk are of immeasurable assistance in locating the problem. All awk tells me is that there is a syntax problem (and the classic skydiving message, of course (-:). Please send assistance! Email would probably be best. I can summarize to the net if there is interest. Thanks in advance. (oh, yeah; for the record: I have **READ** every FM (fu***ng manual) I have access to. All RTFM comments to /dev/null, thank you) -- Tom : The conservatives always grouse about "Law & Order" when the liberals Keller : break the law...when the Reagan Admin. does it, it's PATRIOTISM! UUCP : {ihnp4,ames,qantel,sun,amdahl,lll-crg,pyramid}!ptsfa!gilsys!mc68020 BITNET : ptsfa!gilsys!mc68020@ames.arpa