#!/bin/sh

txtRED='\e[1;31m' # Red
txtdfl='\e[0m' # Default
echo -e "${txtRED}searching for $@${txtdfl}";

#find . -not -iwholename "*.svn" -name "*.[ch]" -exec grep -nH --color=auto $@ {} \;

find . -type d -a -name .svn -prune -o -name "*.[ch]" | xargs grep -nH --color=always "$@"
#find . -name "*.[ch]"  -exec grep -nH --color=auto --exclude-dir=.svn $@ {} \;
#try ack

function fbisp () {
find . -type d -name "products" -prune -o -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f -name "*.py"   -print | xargs /bin/grep -i -n $1 | /bin/grep -iv matches
}                                                                                                                     
# find base inside products
function fbip () {                                                                                                    
find .                                    -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f -name "*.py"   -print | xargs /bin/grep -i -n $1 | /bin/grep -iv matches
}                                                                                                                     
# find base source products
function fbsp () {                                                                                                    
find . -type d -name "products" -prune -o -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f -name "*.py"   -print |       /bin/grep -i    $1 | /bin/grep -iv matches
}                                                                                                                     
# find base products
function fbp () {                                                                                                     
find .                                    -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f -name "*.py"   -print |       /bin/grep -i    $1 | /bin/grep -iv matches
}

# find base inside sources C [.c/.h]
function fbisc () {
find . -type d -name "products" -prune -o -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f -name "*.[ch]" -print | xargs /bin/grep -i -n $1 | /bin/grep -iv matches
}
# find base inside C
function fbic () {
find .                                    -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f -name "*.[ch]" -print | xargs /bin/grep -i -n $1 | /bin/grep -iv matches
}
# find base sources C
function fbsc () {
find . -type d -name "products" -prune -o -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f -name "*.[ch]" -print |       /bin/grep -i    $1 | /bin/grep -iv matches
}
# find base C
function fbc () {
find .                                    -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f -name "*.[ch]" -print |       /bin/grep -i    $1 | /bin/grep -iv matches
}

# find base inside sources
function fbis () {
find . -type d -name "products" -prune -o -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f                -print | xargs /bin/grep -i -n $1 | /bin/grep -iv matches
}
# find base inside
function fbi () {
find .                                    -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f                -print | xargs /bin/grep -i -n $1 | /bin/grep -iv matches
}
# find base sources
function fbs () {
find . -type d -name "products" -prune -o -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f                -print |       /bin/grep -i    $1 | /bin/grep -iv matches
}
# find base
function fb () {
find .                                    -type d -name "\.svn" -prune -o -name "%*" -prune -o -type f                -print |       /bin/grep -i    $1 | /bin/grep -iv matches
}

