I'm trying to come up with command using AWK which will list down all the processes along with its number of instances running:
I'm using following command
ps axo pid,command | awk -F/ '{print $1, $4}'
and I;m getting following result
1727 sshd
1807 httpd
1834 abrtd
1842 abrt-dump-oops -d abrt -rwx
1848 httpd
1849 httpd
1879 gpm -m
I want to above command so that it can display total number of process count along with the process, something as follows
1 1727 sshd
3 1807 httpd
1 1834 abrtd
1 1842 abrt-dump-oops -d abrt -rwx
1 1879 gpm -m
In fact I want to kill a process running more than 5 instances does not matter what process it is.