bash oneliner to find string in common websites files


/ Published in: Bash
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.