I have the following csv file:
id,name,age,male
1,lily,10,girl
2,bob,12,boy
3,lucy,12,girl
4,duby,10,boy
5,bob,11,boy
6,bob,10,boy
7,lucy,11,girl
Now, I want to use splunk to count the number of times each name is repeated, and the result after counting should be as follows:
id,name,age,male,result
1,lily,10,girl,1
2,bob,12,boy,3
3,lucy,12,girl,2
4,duby,10,boy,1
5,bob,11,boy,3
6,bob,10,boy,3
7,lucy,11,girl,2
How can I use SPL to accomplish this task?
Try the eventstats command.
| eventstats count as result by name