Answers for "awk get last argument"


awk get last argument

You can use $NF with the command awk to get the last argument as follows:
awk -F 'delimiter' '{print $NF}'
And for getting penultimate or previous arguments type $(NF-n):
awk -F 'delimiter' '{print $(NF-1)}' #penultimate argument
Posted by: Guest on October-22-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language