![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How is use sselect statement o/p in insert statement. | nkosaraju | Shell Programming and Scripting | 2 | 08-06-2008 10:26 PM |
| conditional statement | lalelle | Shell Programming and Scripting | 8 | 08-21-2007 09:57 AM |
| quoting in conditional statement | 3Gmobile | Shell Programming and Scripting | 2 | 08-14-2006 04:14 AM |
| awk conditional statement | 3Gmobile | Shell Programming and Scripting | 10 | 08-09-2006 11:01 AM |
| more elegant way for conditional statement needed | candyflip2000 | Shell Programming and Scripting | 3 | 05-18-2006 08:52 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
conditional statement
Hi all,
The following code is to find if a list of numbers from one file are within the range in another file. awk -F, '\ BEGIN { while ((getline < "file2") > 0) file2[$2]=$3 } {for (col1 in file2) if ($0>=30 && $1<=45) print $0} ' FILE1 But where I have the number 30 and 45, I want this to refer to column1 and column 2, respectively of another file (FILE1) and print from FILE1 if the conditional statement is true. I feel I am almost there! Thanx Sabz |
|
||||
|
Hi cfajohnson,
Not line for line. The files are also not the same length File 1 is tab delimited: 10 8 30 44 50 59 94 96 File 2 is: 25 29 38 41 49 54 So the code should "for each line in file 2, loop file1 and if column1(file2) is >= column1(File1) AND column2(file2) is <=column2(file1), then print the matching line from File1. Thankyou |
|
||||
|
No duplicate or cross-posting, please read the rules.
Continue here: For loop using 2 files Thread closed. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|