Hi,
PROCINFO seems to be a great function but I don't manage to make it works.
input:
B,A,C
B
B,B
As an example, just want to count the occurence of each letter across the input and sort them by decreased order.
Wanted output:
B 4
A 1
C 1
When I use this command, the PROCINFO does not have any effect:
echo -e "B,A,C\nB\nB,B" | gawk '{a=split($0,b,","); for(i=1; i<=a; i++){count[b]++}}END{PROCINFO["sorted_in"]="@_val_num_desc"; for(k in count){print k FS count[k]}}'
I get this output:
A 1
B 4
C 1
Could someone explain me what I am doing wrong?
Thanks !