| Author |
Recursive patter search in UNIX
|
|
| vijay_v_g@rediffmail.com 2005-11-18, 7:01 pm |
| I'm looking at getting list of files that contain certain patter say
"ABC". How to do that? I tried using "find. |grep "patter"
| |
| Pascal Bourguignon 2005-11-18, 7:01 pm |
| vijay_v_g@rediffmail.com writes:
> I'm looking at getting list of files that contain certain patter say
> "ABC". How to do that? I tried using "find. |grep "patter"
find . -name \*ABC\* -print
or:
find . -name '*ABC*' -print
--
"Specifications are for the weak and timid!"
| |
| Jim Cochrane 2005-11-18, 7:01 pm |
| In article <87u0ea3p1d.fsf@thalassa.informatimago.com>, Pascal Bourguignon wrote:
> vijay_v_g@rediffmail.com writes:
>
>
> find . -name \*ABC\* -print
> or:
> find . -name '*ABC*' -print
>
I think the OP meant to search for the pattern within the contents of each
file - e.g.:
find . -type f -exec grep -l '\<ABC\>' {} ';'
--
Jim Cochrane; jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
| |
| Chris Friesen 2005-11-18, 7:01 pm |
| vijay_v_g@rediffmail.com wrote:
> I'm looking at getting list of files that contain certain patter say
> "ABC". How to do that? I tried using "find. |grep "patter"
How about something like
grep -rs "pattern"
alternately,
find . |xargs grep "pattern"
Chris
|
|
|
|