If you want to display file name while searching,
$ grep -H "555231" *.txt
If you want to search all files recursively in the current directory,
$ grep -R "555231" .
Or if you want to search only *.txt files recursively, try this:
$ find . -iname "*.txt" -exec grep -H "555231" {} \;
Regards,
Ershad
http://ershadk.com
On 3/15/12, Manoj K <[email protected]> wrote:
> Hi,
>
> On the same time, is it possible to find, in which file right now grep
> is searching for, as in that folder a lot of file is der.
>
>
> On Thu, Mar 15, 2012 at 6:43 PM, Anoop Jacob Thomas
> <[email protected]>wrote:
>
>> I didn't quite understand your question.
>>
>> If your question is, can I search for a particular phrase inside
>> several text files using grep, yes you can.
>>
>> And you have mentioned the code in your mail itself.
>>
>> Let's say I want to look in all txt files in a folder if it contains
>> the word "hello", then you can do this,
>>
>> grep hello *.txt
>>
>> --
>> Anoop Jacob Thomas
>>
>> --
>> "Freedom is the only law".
>> "Freedom Unplugged"
>> http://www.ilug-tvm.org
>>
>> You received this message because you are subscribed to the Google
>> Groups "ilug-tvm" group.
>> To control your subscription visit
>> http://groups.google.co.in/group/ilug-tvm/subscribe
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>>
>>
>>
>> For details visit the google group page:
>> http://groups.google.com/group/ilug-tvm?hl=en
>>
>
>
>
> --
> -------------------------------------------------------------------------
>
> *Thanks&Regards*
> **********************
> *Manoj k
> Bangalore.*
> *
> *****************************************************************************************
> *
> "I will not say that i have failed a thousand times.I will say i have found
> a thousand ways that will cause failure"
>
> --
> "Freedom is the only law".
> "Freedom Unplugged"
> http://www.ilug-tvm.org
>
> You received this message because you are subscribed to the Google
> Groups "ilug-tvm" group.
> To control your subscription visit
> http://groups.google.co.in/group/ilug-tvm/subscribe
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
>
>
>
> For details visit the google group page:
> http://groups.google.com/group/ilug-tvm?hl=en
>
--
Sincerely,
Ershad K
http://ershadk.com
--
"Freedom is the only law".
"Freedom Unplugged"
http://www.ilug-tvm.org
You received this message because you are subscribed to the Google
Groups "ilug-tvm" group.
To control your subscription visit
http://groups.google.co.in/group/ilug-tvm/subscribe
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For details visit the google group page:
http://groups.google.com/group/ilug-tvm?hl=en