This is a discussion on How to match two fields within the Shell scripting forums, part of the Development/Scripting category; Hello All, I need a urgent help regarding one issue here. Let me explain the problem. I have a file &...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
Hello All,
I need a urgent help regarding one issue here. Let me explain the problem. I have a file "player" which contains three players with their RUN and ECONOMY rate. ---------- Name Run Economy David 23 8 stuart 12 12 string 33 4 ----------- Now i want to find best player who has highest run but lowest economy rate. Means according to this file best player shud be "string". How i proceed ... first i took highest run and lowest economy in a variables (i and j). i=`cat player | awk 'BEGIN { FS= " " } {print $2}' | grep -v Run | sort -nr | head -1` --------- bash-3.1$ echo $i 33 ------ j=`cat player | awk 'BEGIN { FS= " " } {print $3}' | grep -v Economy | sort -n | head -1` --------- bash-3.1$ echo $j 3 bash-3.1$ ---------- Now the problem is how to match two fields that am not sure. Plzzz help me .. : ![]() |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| match the columns of 2 files and merge common rows | piyali_biobase | Shell scripting | 0 | 11-05-2007 06:34 PM |
| diff command to exclude files that match pattern | piggy | Getting started tutorials | 1 | 08-13-2007 10:52 PM |
| Sorting individual records in a file based on some fields | cucu81 | Shell scripting | 1 | 07-25-2006 03:08 AM |