tpham1002002
Technical User
I am learning tcl/tk and my first task is to write a program to count the repeat number in the second column of this file with content
January 4000 300 200
February 2000 100 0
March 4000 50 10
April 4000 120 300
May 1000 100 0
June 2000 0 0
July 400 1 1
August 4000 200 100
September 2000 100 200
October 0 0 0
Then the program will write to an output file with content
January 4000 300 200 1
February 2000 100 0 1
March 4000 50 10 2
April 4000 120 300 3
May 1000 100 0 0
June 2000 0 0 2
July 400 1 1 0
August 4000 200 100 4
September 2000 100 200 3
October 0 0 0 0
Notice that the last column has been added and it counts the number in second column (from the left) if they are repeat .
It is difficult for me so I would like to have your help.
Regards
Tony
January 4000 300 200
February 2000 100 0
March 4000 50 10
April 4000 120 300
May 1000 100 0
June 2000 0 0
July 400 1 1
August 4000 200 100
September 2000 100 200
October 0 0 0
Then the program will write to an output file with content
January 4000 300 200 1
February 2000 100 0 1
March 4000 50 10 2
April 4000 120 300 3
May 1000 100 0 0
June 2000 0 0 2
July 400 1 1 0
August 4000 200 100 4
September 2000 100 200 3
October 0 0 0 0
Notice that the last column has been added and it counts the number in second column (from the left) if they are repeat .
It is difficult for me so I would like to have your help.
Regards
Tony