Return to Snippet

Revision: 32360
at September 23, 2010 00:51 by niels_bom


Initial Code
find . -type f \( -name "*.js" -o -name "*.php" -o -name "*.class" -o -name "*.inc" -o -name "*.html" -o -name "*.htm" -o -name "*.css" \) -exec grep -il 'needleString' {} \;

Initial URL


Initial Description
I use this bash oneliner all the time to recursively search for a string in large codebases. I use it when searching for mentions of tables, databases, function definitions, function calls etcetera.\r\n\r\nIt searches through a number of file types (.js .php .class .inc .html .htm .css) and skips all the others, which speeds up the search if the codebase contains large non-code files.\r\n\r\nYou can add or delete filetypes to adapt it to your needs, you can probably figure out the syntax by looking at the current code.\r\nYou can add your own fi

Initial Title
bash oneliner to find string in common websites files

Initial Tags
Bash, search, find

Initial Language
Bash