4 ms·
If you just want to count unique IPs, you can get that in awk alone and avoid sort: awk '{ip[$1]=1}; END{ print length(ip) }' Use the hash tables directly
by dredmorbius 9y ago
If you just want to count unique IPs, you can get that in awk alone and avoid sort:
awk '{ip[$1]=1}; END{ print length(ip) }'
Use the hash tables directly, assuming you've got the memory. That should be slightly faster as it avoids the sort.
- asicsp 9y agonice one also, {ip[$1]} is enough...
- dredmorbius 9y agoThanks, I was trying to think of the fastest possible assignment.