I am writing output of awk to array in bash like so:
ARR=$(( awk '{print $2}' file.txt ))
Imagine the content of file.txt is:
A B
A B
A C
A D
A C
A B
What I want is number of repetition of each string in second column like:
B: 3
C: 2
D: 1
Any other solution rather than arrays and awk is welcome.