BEGIN/END blocks awk

Run code before and after processing all lines

awk 'BEGIN{print "Start"} {lines++} END{print lines" lines processed"}' file.txt