Блоки BEGIN/END awk

Выполнить код до и после обработки всех строк

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