I want to compare each element of column 2 with an increasing value 1 to 10. If it matches, I want to count and print them in a new file with tab in between. Example:
X Y
1 1
2 1
3 1
4 2
5 2
6 2
7 4
8 4
9 4
10 4
I want to check if Y column matches with 1 (in this case it matches 3 times) So I want output to be printed as follows in a file output.txt
output.txt
[result]
1 2 3
Next want to look for Y column with value 2 (in this case I have 3 matches) So want to append the count to output.txt
output.txt
[result]
1 2 3
4 5 6
Next want to look for Y column with value 4 (in this case I have 4 matches) So want to append the count to output.txt
output.txt
[result]
1 2 3
4 5 6
7 8 9 10
I am beginner and would appreciate you kind help.
Thanks and regards, Bikash