/regular expression/ {statement(s)}
/regular expression/ {statement(s)}
- The -F option with the colon(:) indicates our field separator is the colon.
- The regular expression indicates to match ksh at the end of each password record.
- The action statement says print the username or login name.
- The action will take place if the pattern match is true.
awk -F: ‘ /ksh$/ { print $1 } ‘ /etc/passwd
This example is useful for finding those user accounts that have /bin/ksh as its startup program.