AWK One Liners

May 21, 2010 mohancheema 0

Simple AWK programs enclosed in single quotes can be typed and executed right at the Unix prompt. For example, the program

awk ‘BEGIN { FS = “:” } { print $1 | “sort” }’ /etc/passwd

This program prints a sorted list of the login names of all users.