Skip to content

Instantly share code, notes, and snippets.

@kyleterry
Created November 23, 2014 04:36
Show Gist options
  • Save kyleterry/9e8c6d3d3b344416000b to your computer and use it in GitHub Desktop.
Save kyleterry/9e8c6d3d3b344416000b to your computer and use it in GitHub Desktop.
#!/bin/bash -
set -x
while IFS=":" read -r filename match;
do
echo $match
tag_name=$(echo ${match} | sed -n "s/^.*{% import \([a-zA-Z0-9_]*\) %}.*$/\1/p")
sed -i "s~${tag_name}\.~~g" ${filename}
sed -i 's~{% import \([a-zA-Z0-9_]*\) %}~{% load \1 %}~g' ${filename}
done < <(grep -r '{% import' * | grep -v docs | grep -v killshit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment