Skip to content

Instantly share code, notes, and snippets.

@noahbliss
Created September 18, 2020 20:08
Show Gist options
  • Save noahbliss/708af359fd8ef34703d93e294d3c03b3 to your computer and use it in GitHub Desktop.
Save noahbliss/708af359fd8ef34703d93e294d3c03b3 to your computer and use it in GitHub Desktop.
Sed wizardry to extract regex from standard in or a file as arg 2.
sed -nE "s#.*($1).*#\1#p" "$2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment