![]() |
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 |
| 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 |
| Simple question (for you guys, hard for me) | BkontheShell718 | Shell Programming and Scripting | 3 | 01-07-2008 11:48 AM |
| [question] trouble with an 'exercise' | EnioMarques | UNIX for Dummies Questions & Answers | 6 | 09-17-2007 09:02 AM |
| Hard Drive Question | Netghost | AIX | 0 | 08-24-2006 01:01 PM |
| Please Help.... Desperate need! Hard Question! | Sparticus007 | UNIX for Advanced & Expert Users | 1 | 01-11-2002 06:43 PM |
| Experts Only! Hard Question Ahead!!!! | Foo49272 | UNIX for Advanced & Expert Users | 1 | 01-07-2002 10:22 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
[question] hard exercise, help needed
Hello guys.
Well, on this exercise i need the average "chargeAmount" per hour (for each hour). with this code : Code:
cat getusagesummarywrongmatch | grep -iv MOU2GRTObject | cut -d'|' -f4,14 | grep -i chargeamount | cut -d' ' -f2 ![]() i got the fields that i need, then with the awk comand i took the 1st and 4th fields separated by ":" . But i couldnt get the total and average of chargeamount for each hour. Hope you guys can help me again ![]() thanks in advance |
|
||||
|
cat getusagesummarywrongmatch | grep -iv MOU2GRTObject | cut -d'|' -f4,14 | grep -i chargeamount | cut -d' ' -f2 | awk
-F':' '{cnt[$1]++} {arr[$1]+=$4} END {for(i in arr) printf("Hour: %d Average: %.2f\n",i,arr[i]/cnt[i])}' | sort; thanks a lot ![]() Last edited by EnioMarques; 09-24-2007 at 08:20 AM.. Reason: worked! |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|