![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| test with two conditions (OR) | chebarbudo | Shell Programming and Scripting | 3 | 11-29-2008 05:39 PM |
| if then statements with two conditions...? | audiophile | Shell Programming and Scripting | 3 | 09-19-2008 03:42 PM |
| Two conditions in one if statement | borobudur | UNIX for Dummies Questions & Answers | 5 | 07-28-2008 10:51 PM |
| How to giv two conditions in IF statement..?? | RRVARMA | Shell Programming and Scripting | 6 | 04-25-2008 10:33 AM |
| problem with if, while, for conditions | kittusri9 | Shell Programming and Scripting | 3 | 04-24-2008 10:15 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
2 or more if conditions
Hello,
I have a file as follows: col no:1 2 3 4 5 6 7 8 9 10 11 a 4 226 226 ch:95024048-95027592, 1y224 of 3545 223 224 ident b 53 235 235 ch:148398-148401255, 1y184 of 3187 180 186 ident awk '{if($2==4) print $0}' test ------> is great for one condition. I want 2 conditions but cannot seem to figure out the syntax needed :if($2==4) && if($9==223) print $0 Any help would be great Cheers Layla |
|
||||
|
Hi dr,
Instead of && use ||. command1 && command2 This statement is read, if command1 is true (has an exit status of zero) then perform command2. The || construct will do the opposite: command1 || command 2 If the exit status of command1 is false (non-zero), command2 will be executed. awk '{if($2==4 || $9==223) print $0}' test Thanks |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|