Sunday, May 6, 2012

finding text in files linux

Using grep for finding some text in group of files can be sometimes complex specially when u have a directory with multiple hierarchy .. currently while looking for some simple option i found this command :
"find . |xargs grep "your_txt""
if you want to find the text in only .C files then also its simple use command:


"find ./ -name "*.C" |xargs grep "your_txt""

such use of find and grep together with xargs can make life simple many times.

No comments:

Post a Comment