Skip to content

Instantly share code, notes, and snippets.

@xai
Created March 3, 2020 10:52
Show Gist options
  • Save xai/22caa409a980435a831bfc3893c9a228 to your computer and use it in GitHub Desktop.
Save xai/22caa409a980435a831bfc3893c9a228 to your computer and use it in GitHub Desktop.
reverse words in second column
{
OFS=FS
n=split($2, words, " ")
$2=""
for(i=n;i>=1;i--) $2=$2 words[i] " "
gsub(/ +$/, "", $2)
print
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment