Example :
The following reads each line or record from the passwd file. If the record starts with a student id, display the 1st (user login id) and 3rd (user_id) fields of the record.
awk -F: '/^z[0-9][0-9][0-9][0-9][0-9][0-9]/ { print $1, $3; }' /etc/passwd
The general structure of an awk command is :
pattern { action cmds }
An awk command may have just a pattern and will act like the grep command. With no action specified, awk will assume a default action of a simple print of the record for which the pattern is matched.
An awk command may have just action commands which will be applied to all lines. The specified actions will be taken if appropriate.
Or it may have both, allowing you to target specific lines or even fields within a line for particular edit actions.