Skip to content

Instantly share code, notes, and snippets.

@tychoish
Created November 13, 2013 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tychoish/7449085 to your computer and use it in GitHub Desktop.
Save tychoish/7449085 to your computer and use it in GitHub Desktop.
SFFMS_FILE=$1
while [ `pcregrep -c -M "^.chapter(.*)\{(.*)\}\n+.newscene" $SFFMS_FILE` -gt 0 ]; do
sed -i -r ':a;N;$!ba;s@(.)chapter.*\{(.*)\}\n{2}.newscene@\1chapter{\2}@m' $SFFMS_FILE
done
@tychoish
Copy link
Author

pcre grep seems like a nifty idea. I had forgotten that it existed.

also what the fuck does :a;N;$!ba; do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment