root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
Not so AIX. This OS favors the "stanza" structure, in which data is presented in this form:
root:
password = XXXXXXXXXXXXX
lastupdate = 1239276751
flags =
joeuser:
password = XXXXXXXXXXXXX
lastupdate = 1239044995
flags =
Ah well, to each their own right? So how do you quickly parse data out of an AIX file? I use this method...probably not the best but it works.
sed -n '/joeuser/,/:/p' /etc/security/passwd
This will return the stanza for joeuser up to and including the next user name below him (:), which you can then grep for whatever field you want.
