Posted By

niels_bom on 09/23/10


Bash search grep webdesign find

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


bash oneliner to find string in common websites files

 / Published in: Bash

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

  1. 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' {} \;

Report this snippet  

You need to login to post a comment.