AIX - check status of local accounts with id>100

I'm trying to extract the users on AIX usinig passwd file and lsuser to find id's > 100. I'm trying the sort as below but it just won't sort and I'm not sure why . any help would be greatly appreciated.

for ID in `grep : /etc/security/passwd | cut -f1 -d':'`;do lsuser -c -a id $ID | grep -v ^# | sort -n  -t: +1 ;done
Who is Participating?
Why don't you use the names and ids contained in /etc/passwd straightaway?
With awk we can easily filter out IDs <= 100 and even make the output look a bit nice.

awk -F: '$3>100 {printf "%-12s%12d\n", $1, $3}' /etc/passwd |sort -k2,n

Including a header line:

printf "\n%-12s%12s\n\n" Username Userid; awk -F: '$3>100 {printf "%-12s%12d\n", $1, $3}' /etc/passwd |sort -k2,n

lolaferrariAuthor Commented:
Many thans once again! Such a great help you are. I have another question that you will surely know the answer to. Would you be able to help with that?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.