The UNIX and Linux Forums
Forum Home
Linux and Unix Man Pages
Search Forums
Search Community Posts
Today's Posts
Quick Links
Man Pages
RedHat Commands
OpenSolaris Commands
Linux Commands
SunOS Commands
FreeBSD Commands
All UNIX Man Pages
All Linux Man Pages
Full Man Repository
Login or Register to Ask a Question and Join Our Community
Search Forums
Show Threads .
Show Posts
Tag Search
Advanced Search
Quick Links
Contact Us
Forum Rules
Today's Posts
FAQ
Pictures & Albums
All Albums
Miscellaneous
What is My IP
Whois
Mark Forums Read
Search Results
Showing results 1 to 1 of 1
Search took
0.00
seconds.
Search:
Posts Made By:
dude2cool
Forum:
Shell Programming and Scripting
12-17-2011
5
Iterating over a list using awk, when variable
11,938
Posted By
dude2cool
Try this: $ gawk 'NR==FNR{ a[$1] += $3;...
Try this:
$ gawk 'NR==FNR{ a[$1] += $3; b[$1]++} NR!=FNR{ for(key in a) {if($1==key)print key,a[key]/b[key]}}' /tmp/1 /tmp/2
Mam189 72.4167
Mam426 78.6133
I used the following sample files:
Showing results 1 to 1 of 1
Member Badges and Information Modal
×