Monday, January 14, 2008

locate the line

i have been asked to answer this same question for the hundredth time.

"how to locate or find specific line or a word in a file or a directory structure using linux shell commands?"

easy.. :)

to find within a file..


grep "your stuff here" filename


to find in directory structure, recursively..


cd /your/target/directory; find . -type f | xargs grep -l "search me"


-l to grep, lists only the file names containing the match

happy search!

0 comments: