dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

find - exec grep question - Unix and OS Discussions

This is a discussion on find - exec grep question - Unix and OS Discussions ; In article , Thomas Tornblom wrote: >Hej Thommy! > >It was just missing from the man page. > >I filed bug 4382701 against the man page for Solaris 9 in Oct 2000. I am sure it was already in the ...



Reply

 

LinkBack Thread Tools Display Modes
  #21  
Old 06-14-2007, 04:56 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: find - exec grep question

In article , Thomas Tornblom wrote:
>Hej Thommy!
>
>It was just missing from the man page.
>
>I filed bug 4382701 against the man page for Solaris 9 in Oct 2000.


I am sure it was already in the SunOS-5.4 man page.

--
EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
js@cs.tu-berlin.de (uni)
schilling@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
Reply With Quote
  #22  
Old 06-14-2007, 07:42 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: find - exec grep question

Thomas Tornblom wrote:
> Hej Thommy!


Tjenare Thomas, läget?

> It was just missing from the man page.
>
> I filed bug 4382701 against the man page for Solaris 9 in Oct 2000.


But I learned find in the 1980's you know... Hope this "new" stuff can finally
stick. ;-)
Reply With Quote
  #23  
Old 06-14-2007, 07:44 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: find - exec grep question

Casper H.S. Dik wrote:
> Stefaan A Eeckels writes:
>
>> On Wed, 13 Jun 2007 20:10:38 GMT
>> "Thommy M." wrote:

>
>
>>> Someone who can say when '+' become available in Solaris find ???

>
>> It's already available on Solaris 2.6 (I checked it just now). Maybe
>> even earlier, but I no longer have access to older versions of Solaris.

>
>
> The source code suggests it was already in 2.0.
>
> But it wasn't documented until much later.



Old habits stick. However I hope I've learned the '+' ending of the -exec switch now.
Reply With Quote
  #24  
Old 06-14-2007, 05:44 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: find - exec grep question

Casper H.S. Dik wrote:

>>> Someone who can say when '+' become available in Solaris find ???

>
> The source code suggests it was already in 2.0.


From the austin-group list [1], quoted to avoid media break

| From: David Korn
| Date: Mon, 26 Mar 2001 11:09:54 -0500 (EST)
|
| I wrote the version of find that went into System V Release 4 version back
| in 1987 and added the feature of accepting + in place of ; to allow xargs
| type grouping without the quoting problems. I was concerned that
| xargs did not handle newlines. Earlier versions of find had their
| own file tree walker code which did not handle symbolic links.
| I wrote ftwalk() (later renamed nftw()) and then wrote find using that
| interface.
|
| Our current find implementation (the AST software), also supports -print0
| but I would recommend against this since the output format
| is no longer a text file that can be processed by many of the
| standard utilities.

BTW: there's a bug in recent AST releases: you have to omit the
braces to really get the expected behaviour (i've submitted a report).

[1] http://opengroup.org/austin/mailarch.../msg03065.html

--

Reply With Quote
  #25  
Old 06-15-2007, 06:04 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: find - exec grep question


If I am understanding you correctly, you want the name of a file that
has a string in it, not the line in the file that has a string in it.
If that is correct, here is the command I normally use on Solaris:

find DIRECTORY -type f -print | xargs -i grep -il "{}"

The above ignores the cases of the string and the case of the text in
the file. If you want to match case, try:

find DIRECTORY -type f -print | xargs -i grep -l "{}"

The above two works even if there are blanks in the file name.

On Jun 12, 9:34 am, mar...@yahoo.com wrote:
> I've been trying to search for a text sting in all files on the drive.
> The following works , BUT the actual file name is not returned (only
> the string occurence is printed). What else do I need???
>
> find /opt/icor/fx -exec grep "text string" {} \;
>
> Thanks a llot,
> Mark



Reply With Quote
  #26  
Old 06-15-2007, 06:14 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: find - exec grep question

If I am understanding you correctly, you want the name of a file that
has a string in it, not the line in the file that has a string in it.
If that is correct, here is the command I normally use on Solaris:

find DIRECTORY -type f -print | xargs -i grep -il "STRING" "{}"

The above ignores the cases of the string and the case of the text in
the file. If you want to match case, try:

find DIRECTORY -type f -print | xargs -i grep -l "STRING" "{}"

The above two works even if there are blanks in the file name.

Replace DIRECTORY and STRING with their correct values.

On Jun 12, 9:34 am, mar...@yahoo.com wrote:

- Hide quoted text -


On Jun 12, 9:34 am, mar...@yahoo.com wrote:
> I've been trying to search for a text sting in all files on the drive.
> The following works , BUT the actual file name is not returned (only
> the string occurence is printed). What else do I need???
>
> find /opt/icor/fx -exec grep "text string" {} \;
>
> Thanks a llot,
> Mark



Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 12:08 PM.