![]() |
|
|
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 |
| Need an AWK script to calculate the percentage | bobprabhu | Shell Programming and Scripting | 8 | 11-07-2008 05:42 AM |
| Awk help needed to calculate total | senthilkumar_ak | Shell Programming and Scripting | 7 | 08-22-2008 01:47 AM |
| grep running total/ final total across multiple files | MrAd | UNIX for Dummies Questions & Answers | 5 | 05-08-2007 02:03 PM |
| Need to total numbers at end of script | wereyou | Shell Programming and Scripting | 9 | 09-22-2006 08:47 PM |
| Please Help ( Calculate time taken in a script) | sanjay92 | UNIX for Dummies Questions & Answers | 9 | 10-02-2001 03:20 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
awk script to calculate total
Hi
First field is the Record Type. A Record Type 5 can have multiple Record Type 6's before another Record Type 5 appears. I want to calculate the total of fields at position 8-11 on Record type 6 when Record Type 5 has a field at position 11-14 equals to '2222'. then it should delete the lines of Record Type 6 except the the first Record Type 6 for that Record Type 5 only. Please help 1 101 201 301 5 test 4444 1233 6 1212 1222 3434 33 7 6464 122 8 3664 123 5 test 2222 1233 6 1212 1222 3434 33 7 4464 322 6 1212 4222 3434 33 7 4464 522 6 1212 6222 3434 33 6 1212 7222 3434 33 8 8664 823 5 test 4444 1233 6 1212 1222 3434 33 7 2464 122 8 3664 123 5 test 4444 1233 6 1212 1222 3434 33 7 7464 122 8 5664 123 5 test 2222 1233 6 61212 1222 3434 33 7 6764 122 8 9664 123 9 3332434 334344 so the output should be 1 101 201 301 5 test 4444 1233 6 1212 1222 3434 33 7 6464 122 8 3664 123 5 test 2222 1233 6 1212 18888 3434 33 7 4464 322 7 4464 522 8 8664 823 5 test 4444 1233 6 1212 1222 3434 33 7 2464 122 8 3664 123 5 test 4444 1233 6 1212 1222 3434 33 7 7464 122 8 5664 123 5 test 2222 1233 6 61212 1222 3434 33 7 6764 122 8 9664 123 9 3332434 334344 |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|