![]() |
|
|
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 |
| multiplication shows syntax error | sonicstage | UNIX for Dummies Questions & Answers | 4 | 08-07-2008 12:21 PM |
| Multiplication with Fractions | alby | Linux | 1 | 07-07-2008 12:25 PM |
| Multiplication Station 0.5.2 (Default branch) | iBot | Software Releases - RSS News | 0 | 05-17-2008 08:40 AM |
| Multiplication Station 0.5.0 (Default branch) | iBot | Software Releases - RSS News | 0 | 02-11-2008 01:20 PM |
| Simple multiplication problem | greekozz | UNIX for Dummies Questions & Answers | 8 | 07-06-2007 10:32 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
using awk multiplication
Suppose i have a file A
1*2*3*4 2*4*4*22 and second file B 2*3*4*5 4*4*6*7 By multiplying file A by file B that is file A by first column in file B respectively output shud be 2*6*12*20 8*16*24*154 my code is [CODE][/ for a in A do for FILE in B do awk 'NR==FNR { x[FNR] =$1 next } {for (f=1;f<=NF;f++) $f*= x[FNR] } 1' OFS='*' FS='*' $a $FILE >file_output done done CODE] then output was 2*3*4*5 8*8*12*14 |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|