Skip to content

Instantly share code, notes, and snippets.

@csabapalfi
Forked from niallsmart/use-strict.sed
Created November 12, 2015 11:02
Show Gist options
  • Save csabapalfi/740c6e0488a06ed3921a to your computer and use it in GitHub Desktop.
Save csabapalfi/740c6e0488a06ed3921a to your computer and use it in GitHub Desktop.
Sed script to add "use strict"; to the top of JavaScript files
#
# Sed script to add "use strict"; to the top of files that don't
# already have it there.
#
# use like this: find . -name \*.js | xargs -n 1 sed -f use-strict.sed -i ''
#
1 { s/use strict/&/
t
i\
'use strict';
x
G
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment