To provide this filtering using AWK, we will pipe the data from lastlog directly to awk. We will make use of a simple control file, initially providing the horizontal filtering or reducing the rows that we see. First, the command pipeline will be as simple as the following command example:
$ lastlog | awk -f lastlog.awk
Of course, the complexity is abstracted from the command line and concealed within the control file that we use. Initially, the control file is kept simple and reads as follows:
!(/Never logged in/ || /^Username/ || /^root/) { print $0; }
The range is set up as we have seen previously and precedes the main code block. Using the exclamation mark in front of the parentheses negates or reverses ...