Last active
August 8, 2016 16:42
-
-
Save voltuer/cdcae475a433244fc876 to your computer and use it in GitHub Desktop.
Búsqueda texto en archivos con find
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
#busca solo en archivos (cambiar type en caso de querer otra cos) | |
#uso: sh buscar.sh <busqueda> <extension> | |
#remoto: bash <(curl -s URL.DEL.GIST) | |
buscar() { | |
echo "Buscando '$bus' en extension '$ext'" | |
find . -type f -exec sh -c "echo {}|grep -q '\.$ext' && echo '\033[0;31m Analizando \033[0;32m {} \033[0m:' && (cat {}|grep \"$bus\") " \; | |
} | |
ext=$2 | |
bus=$1 | |
if [ -z $bus ]; then echo -n "Buscar: "; read bus; fi | |
[[ ${#bus} -gt 2 ]] && buscar | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment