I've been trying to come up with a solution for the following problem; I have an input file with two columns and I want to print as an output the first column without any changes but for the second column, I want to divide it by its last value. Example input:
1 9
2 10
3 11
4 12
5 13
6 14
Desired output:
1 9/14
2 10/14
3 11/14
4 12/14
5 13/14
6 14/14
So I don't really know how to read the file once in order to get the last value of the second column and then read it once again in order to print both columns, the second one divided by this last value.
I'm not too sure how to pass the file as "inputfile" because I'm using a pipe from a previous awk result as an input ...so I'm basically doing a whole bunch of awks and this would be the last one:
and the new awk is not doing this sum properly.... since each value on the second column is an accumulation.
The final step there would be only to divide each value by the last (so the final accumulation) value on the second column, and I can't seem to achieve that.
The output of the second column should be in a range from something to 1.... since well of course the last value would be divided by itself