Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-18 Thread Alexander Batischev
On Fri, Sep 17, 2010 at 11:07:53PM -0600, Bob Proulx wrote: > Albretch Mueller wrote: > But newer POSIX standard find can use a {} + to launch grep once and > to pass as many files on the command line as the system allows. That > is faster since grep is launched only as many times as needed. > Us

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Bob Proulx
Albretch Mueller wrote: > $ find -name '*.extension' -exec grep -H 'pattern' {} \; Using {} \; is the old way. That invokes grep once per file. That works but is slower and less efficient than it could be because it takes a little bit of time to launch grep. But newer POSIX standard find can us

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Stephen Powell
On Fri, 17 Sep 2010 14:08:18 -0400 (EDT), Albretch Mueller wrote: > > I need to: >~ search for files using a pattern (say all files with a certain extension) >~ then search inside each of the found files for a word or regexp pattern >~ You could do this using find, cat and grep in a s

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Alexander Batischev
On Fri, Sep 17, 2010 at 06:32:06PM +, Albretch Mueller wrote: > > if you need certain extension, you don't even need cat and find, it's all > > about grep: > > > $ grep 'string' *.extension > ~ > The thing is that I need to know in which file the pattern was found > and as you guys suggested

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Joe Brenner
Albretch Mueller wrote: > I need to: > ~ > search for files using a pattern (say all files with a certain extension) > ~ > then search inside each of the found files for a word or regexp pattern > ~ > You could do this using find, cat and grep in a script, but I was > wondering about how cou

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Albretch Mueller
> if you need certain extension, you don't even need cat and find, it's all > about grep: > $ grep 'string' *.extension ~ The thing is that I need to know in which file the pattern was found and as you guys suggested: ~ $ find -name '*.extension' -exec grep -H 'pattern' {} \; ~ does it ~ Thank

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Camaleón
On Fri, 17 Sep 2010 18:08:18 +, Albretch Mueller wrote: > I need to: > ~ > search for files using a pattern (say all files with a certain > extension) > ~ > then search inside each of the found files for a word or regexp pattern > ~ > You could do this using find, cat and grep in a script,

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Alexander Batischev
On Fri, Sep 17, 2010 at 06:08:18PM +, Albretch Mueller wrote: > I need to: > ~ > search for files using a pattern (say all files with a certain extension) Is this part so complicated that bash can't handle it? I mean, if you need certain extension, you don't even need cat and find, it's all a

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Axel Freyn
Hi Albrecht, On Fri, Sep 17, 2010 at 06:08:18PM +, Albretch Mueller wrote: > search for files using a pattern (say all files with a certain extension) > then search inside each of the found files for a word or regexp pattern > You could do this using find, cat and grep in a script, but I was