Is there a way to print last line of a file then first line of a file in awk only?
Just save the first line to a variable
awk 'NR==1 {first = $0} END {print; print first}' file
Ex. given file
as
line 1
line 2
line 3
line 4
line 5
then
$ awk 'NR==1 {first = $0} END {print; print first}' file
line 5
line 1