find files containing text
$ grep -lir "some text" * -l outputs only the file names -i ignores the case -r descends into subdirectories View this command to comment, vote or add to favourites View all commands by decept by David...
View Articlefind files containing text
$ grep -lir "sometext" * > sometext_found_in.log I find this format easier to read if your going through lots of files. This way you can open the file in any editor and easily review the file View...
View ArticleFind all files containing a word
$ grep -rHi searchphrase *.php shorter :p View this command to comment, vote or add to favourites View all commands by psybermonkey by David Winterbottom (codeinthehole.com)
View ArticleList files containing given search string recursively
$ find /path/to/dir -type f -print0 | xargs -0 grep -l "foo" View this command to comment, vote or add to favourites View all commands by apotheos by David Winterbottom (codeinthehole.com)
View Articlefind files containing text
$ grep -H -r "string" ./* >> grep.txt View this command to comment, vote or add to favourites View all commands by leonteale by David Winterbottom (codeinthehole.com)
View ArticleRecursively search and replace old with new string, inside every instance of...
$ find . -type f -name filename.exe -exec sed -i "s/oldstring/oldstring/g" {} +; This is a slightly modified version of...
View ArticleA command to find and replace text within conf files in a single directory.
$ find -type f -name '*.conf' -exec sed -Ei 's/foo/bar/' '{}' \; note that sed -i is non-standard (although both GNU and current BSD systems support it) Can also be accomplished with find . -name...
View ArticleSearch for a line of text in a directory of files recursively (while limiting...
$ egrep -ir --include=*.{php,html,css} "(first|second)" . View this command to comment, vote or add to favourites View all commands by CMCDragonkai Diff your entire server config at ScriptRock.com
View Article