![]() |
|
|
|||||||
| Home | Forums | Register | Rules & FAQ | Members List | Arcade | 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 !! |
Other UNIX.COM Threads You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| AWK - printing certain fields when field order changes in data file | eric4 | Shell Programming and Scripting | 3 | 04-15-2008 03:48 PM |
| How to split a field into two fields? | vbrown | Shell Programming and Scripting | 4 | 02-21-2008 02:50 AM |
| I need help counting the fields and field separators using Nawk | scrappycc | Shell Programming and Scripting | 3 | 02-06-2008 07:47 PM |
| how to include field separator if there are blank fields? | ReV | Shell Programming and Scripting | 19 | 07-13-2005 01:50 AM |
| AWK create loop for fields | tonet | Shell Programming and Scripting | 1 | 07-07-2005 06:50 AM |
![]() |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Create a calculated field from existing fields
I need to add an average field to a file. I can create it in an on-screen report and it does what I need using the awk command but I can't get it to create a new file with the additional field. Here's what I'm working with:
file layout: id:lastname:firstname:grade1:grade2:grade3:grade4 I need the avg field added after grade 4. The calculation I used in the awk statement to print the extra field was: ($4*.5+$5*.2+$6*.1+$7*.2) I can't get this into a file though. Any ideas would be greatly appreciated. Thanks |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
Code:
awk_command file >tmp mv tmp file |
|||
| Google UNIX.COM |