Fedora And Red Hat System Administration/Awk Scripting

Awk - A Data Driven Programming LanguageEdit

Under Construction

Using Awk at the Command LineEdit

Under Construction

Awk ScriptsEdit

Parsing User Information from passwd dataEdit

/usr/local/bin/bash-users.awk

#!/bin/awk -f
BEGIN {
    FS = ":"
    USER_COUNT = 0
}

/:\/bin\/bash$/ {
    ++USER_COUNT
    print $1
}

END {
    print USER_COUNT " bash users."
}

Usage:

[user@station user]$ getent passwd | bin/bash-users.awk
root
jkupferer
mesa
user
4 bash users.
Last modified on 30 June 2006, at 18:33