Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Created May 20, 2024 02:09
Show Gist options
  • Save lidgnulinux/ef44f76fb43dff065f78f494554c547c to your computer and use it in GitHub Desktop.
Save lidgnulinux/ef44f76fb43dff065f78f494554c547c to your computer and use it in GitHub Desktop.
Print second column to last column using awk.

Using awk to print second column to last column.

$ echo "first second third N69 NeNN" | awk '{ print substr($0, index($0,$2)) }'

The output will be :

second third N69 NeNN

source : https://stackoverflow.com/a/6630921

@lidgnulinux
Copy link
Author

Won't work if the first, second and third are equal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment