==> user.application.2020-01-16-00-00.csv
user1,app1
user1,app2
user2,app1
user3,app1
==> user.application.2020-01-16-00-30.csv
user1,app1
user2,app1
user2,app4
user10,app2
user10,app1
user4,app5
I want output like as follows, app followed by distinct number of users
app1,4
app2,2
app4,1
app5,1
CodePudding user response:
Store all combinations in an array and print the length of the array.
awk -F, '{a[$2][$1]} END { for (i in a) { print i "," length(a[i]) } }' *.csv