awk OPTIONS PROGRAM FILE
OFS="" Add seperator between ""
$NF End of file
'BEGIN {print "SomeText"}' Start with text
Pipe who command to awk and print the first and third object in a line
who | awk '{print $1,$3}'
Cat a file and print first, second and last word of the file
cat <file> | awk '{print $1,$2,$NF}'
Get date, month year
date | awk '{print $2,$3,$4}'
Result: 28 feb 2020
Use a file with seperator : in items
awk -F: '{print $1,$6}' /etc/passwd
Grab first and last word per line in file
$ cat testfile.txt
This is a test file.
Or not this kind of test file.
Where are the cats.
$ cat testfile.txt | awk '{print $1,$NF}'
This file.
Or file.
Where cats.