X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fbuildor%2Ffind_in_code.sh;h=f479505ff2bcd00668bcc32eb45de076b317659a;hb=81ff468e27ccaf567a2c25d4356d9c8e10810609;hp=ed9cb859a11ef042b27a06e8e946298d56df2138;hpb=7a4ba9b7648ab1f1dc9e5226f74ce94572bfb3cd;p=feisty_meow.git diff --git a/scripts/buildor/find_in_code.sh b/scripts/buildor/find_in_code.sh index ed9cb859..f479505f 100644 --- a/scripts/buildor/find_in_code.sh +++ b/scripts/buildor/find_in_code.sh @@ -1,4 +1,34 @@ #!/bin/bash seek="$1"; shift +if [ -z "$seek" ]; then + echo This script needs a pattern to look for in the current directory. + echo All code files here and in subdirectories will be searched for the + echo pattern. + exit 1 +fi +#hmmm: might be nice to support multiple directories... +# just need to pass them to find as an array maybe? +dir="$1"; shift +if [ -z "$dir" ]; then + dir=. +fi + +find "$dir" -type f \( -iname "*" \ + ! -iname "*.class" \ + ! -iname "*.dll" \ + ! -iname "*.exe" \ + ! -iname "entries" \ + ! -iname "*.git" \ + ! -iname "*.gz" \ + ! -iname "*.jar" \ + ! -iname "*.lib" \ + ! -iname "*.obj" \ + ! -iname "*.svn" \ + ! -iname "*.svn-base" \ + ! -iname "*.tar" \ + ! -iname "*.tmp" \ + ! -iname "*.zip" \) \ + -exec echo "\"{}\"" ';' | xargs grep -li "$seek" +#| grep -v "^\.[^\/]\|\/\." + -find . -type f -exec echo "\"{}\"" ';' | grep -v '.svn' | grep -v '.git' | grep -v '.exe' | grep -v '.obj' | grep -v '.class' | grep -v '.dll' | grep -v '.lib' | xargs grep -li "$seek"