Skip to content

Instantly share code, notes, and snippets.

@yowcow
Last active December 10, 2019 04:17
Show Gist options
  • Save yowcow/42978f870c41d6e71f0582ab7111f3c9 to your computer and use it in GitHub Desktop.
Save yowcow/42978f870c41d6e71f0582ab7111f3c9 to your computer and use it in GitHub Desktop.
AWK regex: capture and print matched pattern that I always forget
cat /path/to/file | awk '$10 ~ /foo/ && match($10, /id=([0-9]+)/, matched) { print matched[1] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment