# awk '/foo/ { print $0 }' test.txt --- To display all lines in which contain the word "foo"
# awk -F: '$3==$4' /etc/passwd --- Print every line which has the same USER ID and GROUP ID
# awk -F: '{ print $1 }' /etc/passwd | sort --- Print a sorted list of the login names of all users
# awk -F: '$7 ~/bash/' /etc/passwd --- To display all lines which contain the word "bash" in the 7th column
# awk -F: '$7~"bash|sh" {print $0}' /etc/passwd --- To display all lines which contain the word "bash" or "sh" in the 7th column as the field seperator is ":"
# awk -F ':' '$3>=100 && $NF ~ /\/bin\/sh/' /etc/passwd --- Print user details who has USER ID greater than or equal to 100 and who has to use /bin/sh
# awk -F ':' '$5 == "" ' --- Print user details who doesn’t have the comments in /etc/passwd file
# echo -n "Total users using BASH Shell = "; awk -F ':' '$NF ~ /bash/ { n++ }; END { print n}' /etc/passwd --- To print total number of users using bash shell
# awk '/^admin/{print}' /etc/hosts --- It matches all the lines that start with the pattern 'admin'
# awk '/[0-9]/{print}' /etc/hosts --- All the line from the file /etc/hosts contain at least a single number [0-9]
# awk '/l.c/{print}' /etc/hosts --- The (.) will match strings containing loc, localhost, localnet .(* l some_single_character c *).
# awk '/[al1]/{print}' /etc/hosts --- Awk will match all strings containing character a or l or 1 in a line in the file /etc/hosts
# awk '/[Kk]T/{print}' /etc/hosts --- Matches strings starting with either K or k followed by T:
# awk '/l*c/{print}' /etc/localhost --- It will match strings containing localhost, localnet