AIX - check status of local accounts with id>100

Posted on 2012-08-31
Last Modified: 2012-09-05
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
Question by:lolaferrari
    LVL 68

    Accepted Solution

    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


    Author Closing Comment

    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?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
    Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    This tutorial goes over how to archive and restore FreeBSD jails that are managed by ezjail.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now