Skip to content

Instantly share code, notes, and snippets.

@nsisodiya
Created May 3, 2014 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsisodiya/e0d7f52918a167f5bb8f to your computer and use it in GitHub Desktop.
Save nsisodiya/e0d7f52918a167f5bb8f to your computer and use it in GitHub Desktop.
This will be helpful in listing all double quoted strings from your js files. It will list strings which has more then 5 spaces
#!/bin/bash
find src -name "*.js" | grep -v src/external | while read i
do
awk -F \" '
{
sep=""
for (i=2; i<=NF; i+=2) {
printf "%s\"%s\"", sep, $i
sep="\n"
}
print ""
}
' $i | sed '/^$/d' | while read w
do
spaces=`echo "$w" | sed 's/\s\+/\n/g'| wc -l`
if [ "$spaces" -gt 5 ]
then
echo $w
fi
done
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment