Skip to content

Instantly share code, notes, and snippets.

@phx
Created June 23, 2013 04:44
Show Gist options
  • Save phx/5843833 to your computer and use it in GitHub Desktop.
Save phx/5843833 to your computer and use it in GitHub Desktop.
(bsd sed): target 3 sections of regex pattern, and further target one specific section to copy to new line.
#!/bin/bash
nl=$'\n'; cat "hello.txt" | sed -E "s/(<img.+src=\")(.+)(\".+)/\1\\$nl\2\\$nl\3/g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment