![]() |
|
|
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 |
| AWK subtraction in multiple columns | awkward | Shell Programming and Scripting | 2 | 01-16-2009 09:11 AM |
| Combine multiple columns from multiple files | martva | Shell Programming and Scripting | 5 | 12-02-2008 09:23 AM |
| sum numbers in multiple files | pattywac | Shell Programming and Scripting | 5 | 07-21-2008 06:21 PM |
| how to find a sum of multiple numbers | aoussenko | Shell Programming and Scripting | 3 | 06-16-2008 03:01 PM |
| sorting a file with multiple columns | outtacontrol | UNIX for Dummies Questions & Answers | 3 | 07-26-2006 02:51 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
AWK solution to subtract multiple columns of numbers
Hope somebody is happy.
NR==1 { num_columns=split( $0, menuend ); next; } { split( $0, substrend ); for ( i=1; i<=NF; i++ ) { minuend[i] -= substrend[i]; } } END { print "Result:"; for ( i=1; i<=num_columns; i++ ) { printf( "%8d", menuend[i] ); } printf "\n"; } |
|
||||
|
haha, this wasn't a question, it was a solution to a question in another thread, I am guess they couldn't find it.
AWK subtraction in multiple columns |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|