2011年9月21日 星期三

[How To] Find Keyword In Files With Grep In Ubuntu



  grep -l -i -n -r 'my_defined_function' /home/ivan/myscripts/




    grep -linr 'my_defined_function' /home/ivan/myscripts/





Here is the definition:

grep is function name to search a pattern in files

-i means ignore case

-n means output line number

-r search recursively

-l just show file name


grep -Ir --exclude="*\.svn*" "pattern" *

 

Exclude some condition which I don't want.

--include=PATTERN     Recurse in directories only searching file matching PATTERN.
--exclude=PATTERN     Recurse in directories skip file matching PATTERN.
 



0 意見:

張貼留言