Skip to content

Instantly share code, notes, and snippets.

@flashvoid
Created February 10, 2023 04:57
Show Gist options
  • Save flashvoid/a3b43205021ce86f367ea4a5245aa780 to your computer and use it in GitHub Desktop.
Save flashvoid/a3b43205021ce86f367ea4a5245aa780 to your computer and use it in GitHub Desktop.
[void@stas-console ~]$ VAR='qwe asd erty dfgh vbn'
[void@stas-console ~]$ echo $(awk -v var="$VAR" 'BEGIN { count=split(var,fields," "); print fields[count-2] }')
erty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment