print nf Source https://unix.stackexchange.com/a/64674/482223 echo "This is a test" | awk '{ print$(NF-2) }' is