Identifying usernames having duplicate user-id in /etc/passwd file
Hi All,
I am trying to find out all users in my /etc/passwd which has duplicate user-ids . e.g if there are two users having user-id of 0. It should display the username as well as the user-id. I tried the following:
awk -F: '{
count[$3]++;}END {
for (i in count)
print i, count[i];
}' passwd
It gives the duplicate user-ids and how many times they are occuring . I actually want the usernames to be displayed along with the duplicate user-ids similar like
zama 0
root 0
bin 100
nologin 100
Will be great if the solution is provided with awk asscociative arrays. Other methods are also fine.
Thanks in Advance
|