Skip to content

Instantly share code, notes, and snippets.

@inhumantsar
Created September 10, 2014 19:05
Show Gist options
  • Save inhumantsar/42707c9598bc993243b5 to your computer and use it in GitHub Desktop.
Save inhumantsar/42707c9598bc993243b5 to your computer and use it in GitHub Desktop.
Extract substring from grep matches
grep openvpn::client dev.pp | sed -e "s/\s*openvpn::client\s*{ '\([a-zA-Z]*\)':/\"\1\",/g"
takes
openvpn::client { 'serged':
openvpn::client { 'danielc':
openvpn::client { 'nigelg':
and converts it to
"serged",
"danielc",
"nigelg",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment