1

Count char, sum and change

view story
linux-howto

http://www.unix.com – Hello, I have some problem in counting char of word, sum and change. I'm not sure shell script can do this. Input data: Code: Sam1 BB BB AA AA BB BB BB Sam2 BB BB AA AA AB AB AB Sam3 BB BB BB AA BB BB BB Sam4 AB AB AB AB AB AB AA Sam5 BB BB AA AA BB BB  -- If I count in column 2, B is 9 which more than A is 1, so in column2 which number of B more than number of A, showed AA is 2, AB is 1 and BB is 0. If I count in column 4, A is 7 which more than B is 3, so in column4 which number of A more than number of B, showed AA is 0, AB is still 1 and BB is 2. Output should be showe (HowTos)