![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Finding my DNS | jjinno | UNIX for Dummies Questions & Answers | 2 | 07-17-2007 09:14 AM |
| finding duplicate files by size and finding pattern matching and its count | jerome Sukumar | Shell Programming and Scripting | 2 | 12-01-2006 04:20 AM |
| Help finding a BOS | zuessh | AIX | 1 | 07-25-2006 02:48 AM |
| Finding last row | indo1144 | UNIX for Advanced & Expert Users | 7 | 09-23-2005 03:25 AM |
| Finding how done IT | geoquest | UNIX for Dummies Questions & Answers | 5 | 08-26-2002 10:12 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Finding max value
My code below is supposed to find which company had the most business and then print the appropriate fields from another file which are the companies ID number and name. I can loop through awk and display all the total amount of business for each company but I need help in only printing out the total, Id, and name for the company with the highest sales amount. Plus, I am having problems only displaying the carrier id and name of each company but my script displays every carrier ID and company name.
Code:
#!/usr/bin/csh
set num = 1
set count = 5
while ($num <= $count)
awk 'BEGIN{count ='$num'}{if($2 == count) {x+=$5}} END{print x}' ShippingOrders.
tab
awk 'BEGIN{count = '$num'}{if($1 == count}{print $1,$2,$3}' Shippers.tab
@ num = $num + 1
end
|
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|