I have some output from which I want the second-last column displayed. I know I can display the n-th column with awk
like this:
... | awk '{print $13}'
However, the number of fields counted from the beginning of the line may vary, only the position counted from the end of the line is stable.
I'm aware that the last field in awk
can be referenced via $NF
... | awk '{print $NF}'
but how do I get to the second-last field from there?