0

I have table of numbers, I want to normalize the table as following:

1- Multiplying column 3 and 7 then add the result to column 11 and multiply the last result with column number 1.

2- Then I want to normalize the table by dividing every number in the table by the result of the previous calculation.

1.31 1.30 1.28 1.26 1.25 1.24 1.22 1.21 1.20 1.19 .25 40
1.71 1.66 1.61 1.57 1.54 1.51 1.47 1.42 1.40 1.38 .10
2.00 1.92 1.84 1.79 1.74 1.69 1.64 1.58 1.54 1.51 .05
2.29 2.18 2.07 2.01 1.94 1.88 1.80 1.72 1.68 1.64 .025
2.66 2.52 2.37 2.29 2.20 2.11 2.02 1.92 1.86 1.80 .01
2.95 2.78 2.60 2.50 2.40 2.30 2.18 2.06 2.00 1.93 .005
3.64 3.40 3.14 3.01 2.87 2.73 2.57 2.41 2.32 2.23 .001
1.29 1.27 1.25 1.24 1.22 1.21 1.19 1.17 1.16 1.15 .25 60
1.66 1.60 1.54 1.51 1.48 1.44 1.40 1.35 1.32 1.29 .10
1.92 1.84 1.75 1.70 1.65 1.59 1.53 1.47 1.43 1.39 .05
2.17 2.06 1.94 1.88 1.82 1.74 1.67 1.58 1.53 1.48 .025
2.50 2.35 2.20 2.12 2.03 1.94 1.84 1.73 1.67 1.60 .01
2.74 2.57 2.39 2.29 2.19 2.08 1.96 1.83 1.76 1.69 .005
3.32 3.08 2.83 2.69 2.55 2.41 2.25 2.08 1.99 1.89 .001

How can I do it using awk?

The results of first calculation should be:

2.3732
4.21806
6.1352
8.58979
12.7611
16.7354
29.3777
2.24137
3.74496
5.2368
7.08462
10.145
12.849
21.1434

After normalizing the table, the results must be:

1.31 1.30 1.28 1.26 1.25 1.24 1.22 1.21 1.20 1.19 .25 40 1.31 1.30 1.28 1.26 1.25 1.24 1.22 1.21 1.20 1.19 .25 402.3732
1.71 1.66 1.61 1.57 1.54 1.51 1.47 1.42 1.40 1.38 .10 1.71 1.66 1.61 1.57 1.54 1.51 1.47 1.42 1.40 1.38 .104.21806
2.00 1.92 1.84 1.79 1.74 1.69 1.64 1.58 1.54 1.51 .05 2.00 1.92 1.84 1.79 1.74 1.69 1.64 1.58 1.54 1.51 .056.1352
2.29 2.18 2.07 2.01 1.94 1.88 1.80 1.72 1.68 1.64 .025 2.29 2.18 2.07 2.01 1.94 1.88 1.80 1.72 1.68 1.64 .0258.58979
2.66 2.52 2.37 2.29 2.20 2.11 2.02 1.92 1.86 1.80 .01 2.66 2.52 2.37 2.29 2.20 2.11 2.02 1.92 1.86 1.80 .0112.7611
2.95 2.78 2.60 2.50 2.40 2.30 2.18 2.06 2.00 1.93 .005 2.95 2.78 2.60 2.50 2.40 2.30 2.18 2.06 2.00 1.93 .00516.7354
3.64 3.40 3.14 3.01 2.87 2.73 2.57 2.41 2.32 2.23 .001 3.64 3.40 3.14 3.01 2.87 2.73 2.57 2.41 2.32 2.23 .00129.3777
1.29 1.27 1.25 1.24 1.22 1.21 1.19 1.17 1.16 1.15 .25 60 1.29 1.27 1.25 1.24 1.22 1.21 1.19 1.17 1.16 1.15 .25 602.24137
1.66 1.60 1.54 1.51 1.48 1.44 1.40 1.35 1.32 1.29 .10 1.66 1.60 1.54 1.51 1.48 1.44 1.40 1.35 1.32 1.29 .103.74496
1.92 1.84 1.75 1.70 1.65 1.59 1.53 1.47 1.43 1.39 .05 1.92 1.84 1.75 1.70 1.65 1.59 1.53 1.47 1.43 1.39 .055.2368
2.17 2.06 1.94 1.88 1.82 1.74 1.67 1.58 1.53 1.48 .025 2.17 2.06 1.94 1.88 1.82 1.74 1.67 1.58 1.53 1.48 .0257.08462
2.50 2.35 2.20 2.12 2.03 1.94 1.84 1.73 1.67 1.60 .01 2.50 2.35 2.20 2.12 2.03 1.94 1.84 1.73 1.67 1.60 .0110.145
2.74 2.57 2.39 2.29 2.19 2.08 1.96 1.83 1.76 1.69 .005 2.74 2.57 2.39 2.29 2.19 2.08 1.96 1.83 1.76 1.69 .00512.849
3.32 3.08 2.83 2.69 2.55 2.41 2.25 2.08 1.99 1.89 .001 3.32 3.08 2.83 2.69 2.55 2.41 2.25 2.08 1.99 1.89 .00121.1434
0

1 Answer 1

1

This command will do the calculation:

awk ' {print $0, $0(($3*$7)+$11)*$1}'
1
  • The people who love downvotes would you please add comment! Commented Oct 9, 2018 at 9:48

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.