Created
April 9, 2015 06:24
-
-
Save anuragpeshne/110b6618e4b4a1f2397b to your computer and use it in GitHub Desktop.
bash to find up largest variable name in PHP and JavaScript
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
egrep -oshRI --include \*.php '(\$[a-zA-Z_0-9]+)' ./ | awk -F ':' '{ print length $1}' | sort -gr | head -n 1 | |
#this will output largest PHP variable name | |
egrep -shIRo --include \*.js '(?:[\n\( ])([a-zA-Z_0-9]+) *=' ./ | awk '{ print length, $1}' | sort -gr | head -n 1 | |
#this will output largest JavaScript variable name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment