Created
July 8, 2012 14:37
-
-
Save pcsanwald/3071225 to your computer and use it in GitHub Desktop.
name java files according to their public class declaration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The regular expression checks for a public class declared in the file. | |
# The match, captured using the $1 variable, then is used to rename the file according | |
# to java conventions, i.e. ClassName.java | |
perl -ne '/public class ([a-zA-Z0-9]+) / && rename($ARGV,$1.".".java)' * | |
# I created this gist because manning ships the source code for "Hadoop in Action" in files called | |
# "listing-2-2", with no indication what kind of file it is. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment