Re: About grep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On January 11, 2004 07:38 pm, Jack Wang wrote:
> I can use the following grep command to find a string
> in current directory:
>
> grep "abc" *.*
>
> How to find a string recursively into subdirectories?
>
> Thanks.
>
> Jack
>

Hi,
You can use it in conjunction with 'find".

Allow 'find' to get the recursive file list and use finds 'exec' ooption.

find /some/dir -exec grep  "some_string" {} \; > some_results_file

To find all the regular files containing "test", case insensitive, in the 
current directory and below, use:

find . -type f -exec grep -i "*test*" {} \; >/tmp/test_results
-- 
Pete Nesbitt, rhce


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux