Skip to content

Instantly share code, notes, and snippets.

@maciej
Created October 3, 2011 15:26
Show Gist options
  • Save maciej/1259368 to your computer and use it in GitHub Desktop.
Save maciej/1259368 to your computer and use it in GitHub Desktop.
Transforms SQL Import script into Java-like entries enum content
# TODO replace the magic 57 with an actual match of the prefix
perl -pe 's/.{57}('.*')\);$/\1/' entries.txt | tr "[:lower:]" "[:upper:]" | sed "s/'//g" | sed -E 's/([^A-Z])+/_/g' | perl -e '$i = 1; while (<>) {chomp; printf("%s(\"%04d\"),\n", $_, $i); $i = $i + 1}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment