Here is my requirement. I would basically like to evaluate the percentage of two fields in a file and write it to an output file.
Input file is a follows:-
col1; col2; col3;
A; 22.32; 11.32;
B; 11111.99; 10920.35;
C; 3567.23; 38.60;
D; 760.25; 575.57;
A; 22.32; 11.32;
B; 11111.99; 10920.35;
C; 3567.23; 38.60;
D; 760.25; 575.57;
It should basically be calculating the difference between col2 and col 3 ( Res1=col2-col3) and divide by col3 ( (res1/col3)*100) to get the percentage.
Output file is as follows :-
col1; col2; col3; col4;
A; 22.32; 11.32;0.9717314487632509
B; 11111.99; 10920.35;0.0175488880850888
C; 3567.23; 38.60;91.41528497409326
D; 760.25; 575.57;0.3208645342877495
A; 22.32; 11.32;0.9717314487632509
B; 11111.99; 10920.35;0.0175488880850888
C; 3567.23; 38.60;91.41528497409326
D; 760.25; 575.57;0.3208645342877495
Can some one help me in achieving it.
Thanks in advance.
P.S. I tried doing it in phase by phase but unable to achieve it.