home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.lang.awk
- Path: sparky!uunet!cs.utexas.edu!hellgate.utah.edu!csn!yuma!sgcraw
- From: sgcraw@CS.ColoState.EDU (stewart crawford)
- Subject: Re: How does one do matching within an if expression?
- Sender: news@yuma.ACNS.ColoState.EDU (News Account)
- Message-ID: <Jan22.232907.55238@yuma.ACNS.ColoState.EDU>
- Date: Fri, 22 Jan 1993 23:29:07 GMT
- References: <1993Jan15.125915.5819@cas.org>
- Nntp-Posting-Host: beethoven.cs.colostate.edu
- Organization: Colorado State University, Computer Science Department
- Lines: 19
-
- In article <1993Jan15.125915.5819@cas.org> lvirden@cas.org (Larry W. Virden) writes:
- >
- >$0 ~ /string 1/ {
- > if ( $0 !~ /string 2/)
- > print $0
- > }
- >
- >but haven't been able yet to figure out the proper syntax.
-
-
- I think we need some thought clarification here.
- You've got two conditions which, when both satisfied, you want an action.
- The "pattern" part of an awk line is where you spell out conditions.
- Therefore:
-
- $0 ~ /string 1/ && $0 !~ /string 2/ { print $0 }
-
- stew crawford.
-
-