• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 517
  • Last Modified:

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
0
lolaferrari
Asked:
lolaferrari
1 Solution
 
woolmilkporcCommented:
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

wmp
0
 
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?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now