Skip to content

Instantly share code, notes, and snippets.

@nodokodo
Created March 4, 2012 02:47
Show Gist options
  • Save nodokodo/1970179 to your computer and use it in GitHub Desktop.
Save nodokodo/1970179 to your computer and use it in GitHub Desktop.
Move <script> tags to bottom of <body> using sed
#!/bin/sh
# warning: only tested on single line script tags, no doubt broken on multi-line
# useful for includes!
[ $# -eq 0 ] && { echo "Usage: ${0} file-name" ; exit 1; }
$FILE=$1
sed -in '/script/{h;d};/\/body/{H;g}' $FILE
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment