Skip to content

Metabolomics Fiehn Lab

Sections
Personal tools
You are here: Home » Members » Gert Wohlgemuth » Linux » How to search in File

How to search in File

Document Actions
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

Created by wohlgemuth
Last modified 2006-04-26 12:05 PM
 

Powered by Plone

This site conforms to the following standards: