Skip to content

Instantly share code, notes, and snippets.

@cecepm
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save cecepm/8913718 to your computer and use it in GitHub Desktop.

Select an option

Save cecepm/8913718 to your computer and use it in GitHub Desktop.
Sed change from href="{{ MEDIA_URL }}css/default.css" to href="{% static "css/default.css" %}"
sed -e 's/href=\"{{ MEDIA_URL }}\([^"]*\)/href="{% static \"\1\" %}/g'

Explanation

  • Syntax sed -e 's/ find / replace /'
  • href=\"{{ MEDIA_URL }} --> match href="{{ MEDIA_URL }}
  • \([^"]*\) --> match any chars before " and save on variable \1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment