Skip to content

Instantly share code, notes, and snippets.

@ch4
Created June 23, 2017 05:34
Show Gist options
  • Save ch4/e4dce7313c9a42df665155c23bed255b to your computer and use it in GitHub Desktop.
Save ch4/e4dce7313c9a42df665155c23bed255b to your computer and use it in GitHub Desktop.
sed regex capture group example
echo "/junk1/harvey/junk2/test.jpg" | sed "s/^.*\/junk1\/\(\S*\)\/junk2.*$/\1/"
# prints "harvey"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment