AWK - Program Structure in UNIX

An AWK program consists of three parts

1. BEGIN
2. ACTION
3. END

When your awk has ACTION OR END part, file name is required. Using BEGIN does not require any file name, so the below program is perfectly valid

Hello world using awk
awk 'BEGIN {print "hello world"}'


Print all lines in file
awk 'BEGIN{print "Start"}{print $0}END{print "END"}' hello.c


$0 is the unix special variable holding entire record