Skip to content

Instantly share code, notes, and snippets.

@soulcutter
Created September 17, 2012 16:27
Show Gist options
  • Save soulcutter/3738320 to your computer and use it in GitHub Desktop.
Save soulcutter/3738320 to your computer and use it in GitHub Desktop.
Adding magic encoding comments to ruby files
#!/bin/zsh
for file in $(awk 'FNR == 1 && !/^#\!/ { print FILENAME; nextfile }' **/*.rb); do
echo $file
sed -i 1i'# encoding: utf-8' $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment