Skip to content

Instantly share code, notes, and snippets.

@maxpeterson
Created November 24, 2015 18:16
Show Gist options
  • Save maxpeterson/af03b6fd75bb8bd47ca1 to your computer and use it in GitHub Desktop.
Save maxpeterson/af03b6fd75bb8bd47ca1 to your computer and use it in GitHub Desktop.
Rename slides in a jekyll edetail project
#!/bin/sh
from=$1; shift
to=$1; shift
echo rename $from $to;
grep -rl --exclude-dir _site "$from" jekyll-project sass | xargs perl -pi -e "s|\Q$from|$to|g"
find jekyll-project sass -name \*"$from"\* -not -path jekyll-project/_site/\* -type d | while read path ; do
new=$(echo "$path" | replace "$from" "$to" --);
git mv "$path" "$new";
done;
find jekyll-project sass -name \*"$from"\* -not -path jekyll-project/_site/\* -type f | while read path ; do
new=$(echo "$path" | replace "$from" "$to" --);
git mv "$path" "$new";
done;
#git commit -a -m "Rename $from" -m "Rename $from to $to"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment