How to search in File
how to use linux tools to search for a pattern in all files in a directory
pretty simple
find ./ -name '*.java' -exec echo {} \; -exec fgrep 127.0.0.1 {} \; | less
find = search tool for file
./ = path to search
-name '*.java' = files we care about
-exec echo {} \; = prints the name of each found file on the command line
-exec fgrep 127.0.0.1 {} \; = searches in each found file for the pattern: 127.0.0.1
| less = so we easily can browse the results
find ./ -name '*.java' -exec echo {} \; -exec fgrep 127.0.0.1 {} \; | less
find = search tool for file
./ = path to search
-name '*.java' = files we care about
-exec echo {} \; = prints the name of each found file on the command line
-exec fgrep 127.0.0.1 {} \; = searches in each found file for the pattern: 127.0.0.1
| less = so we easily can browse the results
Created by
wohlgemuth
Last modified 2006-04-26 12:05 PM
Last modified 2006-04-26 12:05 PM