My question is on following file: (either use korn shell or perl to solve)
51 19UTEX B
1008 19UTEX N
1480 19UTEX X
6942 19UTEX Y
How can I achieve the following. I want to get the total of left most field with numbers. Then subtract count of right most filed that either says "B" or "N".
Forexample:
Total of left most field is => 9481
Count of right most field that has letter "B" is => 51
Count of right most field that has letter "N" is => 1008
Hensce new number = 9481 - (subtract) (51+1008) ==> 8422
SInce i have to get following number manually, Is this possible with the help of perl or korn script. the file will always look the same.
Thanks
51 19UTEX B
1008 19UTEX N
1480 19UTEX X
6942 19UTEX Y
How can I achieve the following. I want to get the total of left most field with numbers. Then subtract count of right most filed that either says "B" or "N".
Forexample:
Total of left most field is => 9481
Count of right most field that has letter "B" is => 51
Count of right most field that has letter "N" is => 1008
Hensce new number = 9481 - (subtract) (51+1008) ==> 8422
SInce i have to get following number manually, Is this possible with the help of perl or korn script. the file will always look the same.
Thanks