Last active
August 29, 2015 14:11
-
-
Save maxheadroom/d71da538b0f5c27f3d4e to your computer and use it in GitHub Desktop.
Find processes with more than X instances
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: ps -e | awf -f find_process_count.awk | |
# output | |
{ | |
limit = 5 | |
# turn the process names into lowercase | |
$4 = tolower($4) # remove case distinctions | |
# count occurances of $4 | |
freq[$4]++ | |
} | |
END { | |
for (word in freq) | |
# print if above limit | |
if (freq[word] > limit ) printf "%s\t\t\t\t%d\n", word, freq[word] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment