Last active
December 10, 2019 04:17
-
-
Save yowcow/42978f870c41d6e71f0582ab7111f3c9 to your computer and use it in GitHub Desktop.
AWK regex: capture and print matched pattern that I always forget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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