find any occurance of a string in any file???

  • Permalink
  • submit to reddit
  • Email
  • Follow


I want to search all the files on my computer for the occurance of a 
particular string.  Before you blast me, I know, this seems silly.  But I 
have a reason.

I can use find ./ -name * to list all files, but how do I send them through 
a "grep" to find any occurance of, say, "poohead" within the files ????


Mairhtin O'Feannag

0
Reply irishboyca (42) 10/8/2003 9:25:48 PM

See related articles to this posting

On Wed, 08 Oct 2003 21:25:48 +0000, Mairhtin O'Feannag wrote:

> I want to search all the files on my computer for the occurance of a 
> particular string.  Before you blast me, I know, this seems silly.  But I 
> have a reason.
> 
> I can use find ./ -name * to list all files, but how do I send them through 
> a "grep" to find any occurance of, say, "poohead" within the files ????

find / -type f -exec grep -l poohead {} +

0
Reply daveuhring (1185) 10/8/2003 9:50:13 PM


On Wed, 08 Oct 2003 21:25:48 GMT, Mairhtin O'Feannag <irishboyca@rocketmail.com> wrote:
> 
> 
> I want to search all the files on my computer for the occurance of a 
> particular string.  Before you blast me, I know, this seems silly.  But I 
> have a reason.
> 
> I can use find ./ -name * to list all files, but how do I send them through 
> a "grep" to find any occurance of, say, "poohead" within the files ????
> 
> 
> Mairhtin O'Feannag
> 

If you have GNU grep, you can do:

grep -rs  'poolhead'  /   # the r means recursive and the s silences error
                          # messages 

If not, then try something like this:

find /  -type f  -exec  grep 'poolhead' {} \;

The {} refers to whatever file find is currently focussing on.


-- 
Later, Alan C
You can find my email address at the website: contact.html
take control of your mailbox ----- elrav1 ----- http://tinyurl.com/l55a
0
Reply zzzzzz (1966) 10/8/2003 9:59:12 PM

Mairhtin O'Feannag wrote:

> I want to search all the files on my computer for the occurance of a
> particular string.  Before you blast me, I know, this seems silly.  But I
> have a reason.
> 
> I can use find ./ -name * to list all files, but how do I send them
> through a "grep" to find any occurance of, say, "poohead" within the files
> ????

$ find . | xargs grep pattern

-- 
Paul Lutus
http://www.arachnoid.com

0
Reply nospam248 (2592) 10/8/2003 10:06:41 PM

Dave Uhring wrote:

> On Wed, 08 Oct 2003 21:25:48 +0000, Mairhtin O'Feannag wrote:
> 
>> I want to search all the files on my computer for the occurance of a
>> particular string.  Before you blast me, I know, this seems silly.  But I
>> have a reason.
>> 
>> I can use find ./ -name * to list all files, but how do I send them
>> through a "grep" to find any occurance of, say, "poohead" within the
>> files ????
> 
> find / -type f -exec grep -l poohead {} +

on my system you need to do:

find / -type f -exec grep -l poohead '{}' ';'

{} means the found file, ; is the delimiter for find -exec, and they both
need quoting.

andy.

-- 
remove 'n-u-l-l' to email me. html mail or attachments will go in the spam
bin unless notified with [html] or [attachment] in the subject line.
0
Reply news21 (108) 10/8/2003 10:07:30 PM

On Wed, 08 Oct 2003 16:50:13 -0500, Dave Uhring <daveuhring@yahoo.com> wrote:
> 
> 
> On Wed, 08 Oct 2003 21:25:48 +0000, Mairhtin O'Feannag wrote:
> 
>> I want to search all the files on my computer for the occurance of a 
>> particular string.  Before you blast me, I know, this seems silly.  But I 
>> have a reason.
>> 
>> I can use find ./ -name * to list all files, but how do I send them through 
>> a "grep" to find any occurance of, say, "poohead" within the files ????
> 
> find / -type f -exec grep -l poohead {} +
> 

Why the  + ?

The only possibly relevant reference to + in the find man page is:

-perm +mode
              Any of the permission bits mode  are  set  for  the
              file.

And it doesn't seem to be part of a regex for grep.... 


-- 
Later, Alan C
You can find my email address at the website: contact.html
take control of your mailbox ----- elrav1 ----- http://tinyurl.com/l55a
0
Reply zzzzzz (1966) 10/8/2003 10:19:12 PM

On Wed, 08 Oct 2003 22:19:12 +0000, Alan Connor wrote:

> Why the  + ?
> 
> The only possibly relevant reference to + in the find man page is:
> 
> -perm +mode
>               Any of the permission bits mode  are  set  for  the
>               file.
> 
> And it doesn't seem to be part of a regex for grep....

It came from Solaris.  I posted the wrong command ;-)

0
Reply daveuhring (1185) 10/8/2003 10:33:56 PM

On Wed, 08 Oct 2003 17:33:56 -0500, Dave Uhring <daveuhring@yahoo.com> wrote:
> 
> 
> On Wed, 08 Oct 2003 22:19:12 +0000, Alan Connor wrote:
> 
>> Why the  + ?
>> 
>> The only possibly relevant reference to + in the find man page is:
>> 
>> -perm +mode
>>               Any of the permission bits mode  are  set  for  the
>>               file.
>> 
>> And it doesn't seem to be part of a regex for grep....
> 
> It came from Solaris.  I posted the wrong command ;-)
> 

<chuckle>

Thanks.

-- 
Later, Alan C
You can find my email address at the website: contact.html
take control of your mailbox ----- elrav1 ----- http://tinyurl.com/l55a
0
Reply zzzzzz (1966) 10/8/2003 10:59:18 PM

On Wed, 08 Oct 2003 22:59:18 +0000, Alan Connor wrote:

> On Wed, 08 Oct 2003 17:33:56 -0500, Dave Uhring <daveuhring@yahoo.com> wrote:

>> It came from Solaris.  I posted the wrong command ;-)
>> 
> 
> <chuckle>
> 
> Thanks.

Solaris find(1):

     -exec command
           True if the executed command returns a zero  value  as
           exit  status. The end of command must be punctuated by
           an escaped semicolon (;). A  command  argument  {}  is
           replaced  by  the current path name. If the last argu-
           ment to -exec is {} and you specify + rather than  the
           semicolon  (;),  the  command  will  be  invoked fewer
           times, with {} replaced by groups of pathnames.

Makes the search run quicker.

0
Reply daveuhring (1185) 10/8/2003 11:25:33 PM

=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 2003-10-08T22:06:41Z, Paul Lutus <nospam@nosite.zzz> writes:

> $ find . | xargs grep pattern

I second this.  It will be a huge win over the "find . -exec grep" syntax in
that it will spawn a vastly smaller number grep processes over the duration
of the run.
=2D --=20
Kirk Strauser
The Strauser Group
Open. Solutions. Simple.
http://www.strausergroup.com/
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/hKQo5sRg+Y0CpvERAurgAJ0XB8pDWsTT6Etuwfy9lyhRDAHkTwCfRLI4
spgHGqo4FzL+7uRGeWML+nk=3D
=3DqPBI
=2D----END PGP SIGNATURE-----
0
Reply kirk (233) 10/9/2003 12:00:19 AM

Mairhtin O'Feannag wrote:
> I can use find ./ -name * to list all files, but how do I send them through 
> a "grep" to find any occurance of, say, "poohead" within the files ????

$ find . -print0 | xargs -0 grep

The "-print0" arg to find and "-0" arg to xargs deal with files with
embedded newlines.

For more info on what xargs does, 
$ man xargs 

Ed

0
Reply news20 (49) 10/9/2003 12:45:25 AM

On Thu, 09 Oct 2003 00:00:19 GMT, Kirk Strauser <kirk@strauser.com> wrote:
> 
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> At 2003-10-08T22:06:41Z, Paul Lutus <nospam@nosite.zzz> writes:
> 
>> $ find . | xargs grep pattern
> 
> I second this.  It will be a huge win over the "find . -exec grep" syntax in
> that it will spawn a vastly smaller number grep processes over the duration
> of the run.
> - -- 
> Kirk Strauser
> The Strauser Group
> Open. Solutions. Simple.
> http://www.strausergroup.com/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
> 
> iD8DBQE/hKQo5sRg+Y0CpvERAurgAJ0XB8pDWsTT6Etuwfy9lyhRDAHkTwCfRLI4
> spgHGqo4FzL+7uRGeWML+nk=
> =qPBI
> -----END PGP SIGNATURE-----


I like the xargs solution, but why do you have to get in our faces with the
PGP crap?

Do you have any idea how FEW people use it, and how FEW people give a
tinker's damn whether you are posting a message with a key registered to
the name Kirk Strauser?

You real name could be Gertrude Hoskenblatt, so what the hell is the point?

If you were communicating with your bank on a sensitive matter involving
patents and copyrights, I could see using PGP.

But HERE, we only care about the quality of our posts, and part of that
quality involves whether you clutter them with useless garbage or not.

It's nothing but a big, pretentious ego-trip.

(if it wasn't, you would put the info in your headers and refer to it in
a short line in your sig, like people with manners do)

Guess what? It is no harder to install PGP than it is to install a frigging
text editor, so I cannot imagine who the hell you think you are impressing.

You have a BIZARRE idea of what constitutes "Solutions" that are "Simple".

If I see the stupid PGP sig again, you are killfiled for 30 days.

(Or are you going to tell me that I have to install a different newsreader
that hides PGP sigs so that you can get some kind of neurotic satisfaction
from chronically advertising the fact that you use a program that most
people don't?)


-- 
Later, Alan C
You can find my email address at the website: contact.html
take control of your mailbox ----- elrav1 ----- http://tinyurl.com/l55a
0
Reply zzzzzz (1966) 10/9/2003 12:59:19 AM

On Wed, 08 Oct 2003 18:25:33 -0500, Dave Uhring <daveuhring@yahoo.com> wrote:
> 
> 
> On Wed, 08 Oct 2003 22:59:18 +0000, Alan Connor wrote:
> 
>> On Wed, 08 Oct 2003 17:33:56 -0500, Dave Uhring <daveuhring@yahoo.com> wrote:
> 
>>> It came from Solaris.  I posted the wrong command ;-)
>>> 
>> 
>> <chuckle>
>> 
>> Thanks.
> 
> Solaris find(1):
> 
>      -exec command
>            True if the executed command returns a zero  value  as
>            exit  status. The end of command must be punctuated by
>            an escaped semicolon (;). A  command  argument  {}  is
>            replaced  by  the current path name. If the last argu-
>            ment to -exec is {} and you specify + rather than  the
>            semicolon  (;),  the  command  will  be  invoked fewer
>            times, with {} replaced by groups of pathnames.
> 
> Makes the search run quicker.
> 

Ahh.

-- 
Later, Alan C
You can find my email address at the website: contact.html
take control of your mailbox ----- elrav1 ----- http://tinyurl.com/l55a
0
Reply zzzzzz (1966) 10/9/2003 12:59:20 AM

On Wed, 08 Oct 2003 21:59:12 GMT, Alan Connor <zzzzzz@xxx.yyy> wrote:
> On Wed, 08 Oct 2003 21:25:48 GMT, Mairhtin O'Feannag <irishboyca@rocketmail.com> wrote:
>> 
>> 
>> I want to search all the files on my computer for the occurance of a 
>> particular string.  Before you blast me, I know, this seems silly.  But I 
>> have a reason.
>> 
>> I can use find ./ -name * to list all files, but how do I send them through 
>> a "grep" to find any occurance of, say, "poohead" within the files ????
>> 
>> 
>> Mairhtin O'Feannag
>> 
> 
> If you have GNU grep, you can do:
> 
> grep -rs  'poolhead'  /   # the r means recursive and the s silences error
>                           # messages 
> 
> If not, then try something like this:
> 
> find /  -type f  -exec  grep 'poolhead' {} \;
> 
> The {} refers to whatever file find is currently focussing on.
> 
> 

I usually do it like this

find / -type f -exec grep 'poolhead' /dev/null \{\} \;

having two files in the arguments for grep will make grep print
out the file name it finds the string in.  Of course it'll never
find it in /dev/null  :)


0
Reply creideiki (13) 10/9/2003 1:59:22 AM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alan Connor wrote:
> I like the xargs solution, but why do you have to get in our faces with the
> PGP crap?
> 
> Do you have any idea how FEW people use it, and how FEW people give a
> tinker's damn whether you are posting a message with a key registered to
> the name Kirk Strauser?
> 
> You real name could be Gertrude Hoskenblatt, so what the hell is the point?
> 
> If you were communicating with your bank on a sensitive matter involving
> patents and copyrights, I could see using PGP.
> 
> But HERE, we only care about the quality of our posts, and part of that
> quality involves whether you clutter them with useless garbage or not.
> 
> It's nothing but a big, pretentious ego-trip.
> 
> (if it wasn't, you would put the info in your headers and refer to it in
> a short line in your sig, like people with manners do)
> 
> Guess what? It is no harder to install PGP than it is to install a frigging
> text editor, so I cannot imagine who the hell you think you are impressing.
> 
> You have a BIZARRE idea of what constitutes "Solutions" that are "Simple".
> 
> If I see the stupid PGP sig again, you are killfiled for 30 days.
> 
> (Or are you going to tell me that I have to install a different newsreader
> that hides PGP sigs so that you can get some kind of neurotic satisfaction
> from chronically advertising the fact that you use a program that most
> people don't?)

Nope, but do find a newsreader with decent filtering capabilities, and have it chuck out any message 
that begins with "BEGIN PGP SIGNED MESSAGE" in the first couple of lines.

I think that will make everyone happier :)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/hNMHeS99pGMif6wRAixfAJwJOmmP3qPmbfo5Bbp00g2yAniG+gCg1sxD
kSIFM+qiKQqgjHx6wzBmCHM=
=Rv4v
-----END PGP SIGNATURE-----

0
Reply spam405 (14) 10/9/2003 3:16:17 AM

On Thu, 09 Oct 2003 00:59:19 +0000, Alan Connor wrote:

> (Or are you going to tell me that I have to install a different newsreader
> that hides PGP sigs so that you can get some kind of neurotic satisfaction
> from chronically advertising the fact that you use a program that most
> people don't?)

Like you do with elrav1.  But you've killfiled me forever (didn't you once
claim that you never do that?); I'm writing this solely for the benefit of
the others reading the thread.

0
Reply emurphy42 (1226) 10/9/2003 4:58:01 AM

=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 2003-10-09T01:59:22Z, Creideiki <creideiki@cfl.rr.com> writes:

> I usually do it like this
>
> find / -type f -exec grep 'poolhead' /dev/null \{\} \;
>
> having two files in the arguments for grep will make grep print out the
> file name it finds the string in.  Of course it'll never find it in
> /dev/null :)

So will the '-l' option to grep:

    $ grep -l foo test.mail
    test.mail

And in any case you really want to use xargs instead of -exec .
=2D --=20
Kirk Strauser
The Strauser Group
Open. Solutions. Simple.
http://www.strausergroup.com/
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/hUp95sRg+Y0CpvERAo7WAJwPfGEk2rPQSq7NqtGE/ZFSF/x8aACePF3q
4nCxH0nDdyfvGmyXETMpUEA=3D
=3DWqZe
=2D----END PGP SIGNATURE-----
0
Reply kirk (233) 10/9/2003 11:50:06 AM

[This followup was posted to comp.os.linux.misc]

In article <Xns940E92E72FD06mairhtinofeannag@64.164.98.49>, 
irishboyca@rocketmail.com says...
> I want to search all the files on my computer for the occurance of a 
> particular string.  Before you blast me, I know, this seems silly.  But I 
> have a reason.
> 
> I can use find ./ -name * to list all files, but how do I send them through 
> a "grep" to find any occurance of, say, "poohead" within the files ????
> 
> 
> Mairhtin O'Feannag

find ./ -name '*' -exec fgrep poolhead /dev/null '{}' \;
0
Reply raisin3 (35) 10/9/2003 1:18:41 PM

That would be "poohead", not "poolhead".   Giggle

It's interesting to me STILL that flame wars can occur in such a 
simple/direct thread.  :)

I used the xargs solution.  Seems to work.  I've come across it before, 
and had simply forgotten it.  Have to write these things down, now that 
I'm old and feeble (NOT!).  

Thanks for all the prompt and helpful responses folks!!!!

M


Barry Kimelman <raisin@delete-this-trash.mts.net> wrote in
news:MPG.19ef1c266d8eeca898969b@news.mts.net: 

> [This followup was posted to comp.os.linux.misc]
> 
> In article <Xns940E92E72FD06mairhtinofeannag@64.164.98.49>, 
> irishboyca@rocketmail.com says...
>> I want to search all the files on my computer for the occurance of a 
>> particular string.  Before you blast me, I know, this seems silly. 
>> But I have a reason.
>> 
>> I can use find ./ -name * to list all files, but how do I send them
>> through a "grep" to find any occurance of, say, "poohead" within the
>> files ???? 
>> 
>> 
>> Mairhtin O'Feannag
> 
> find ./ -name '*' -exec fgrep poolhead /dev/null '{}' \;
> 

0
Reply irishboyca (42) 10/9/2003 4:57:00 PM

On Wed, 08 Oct 2003 21:25:48 +0000, Mairhtin O'Feannag wrote:

> I want to search all the files on my computer for the occurance of a
> particular string.  Before you blast me, I know, this seems silly.  But I
> have a reason.
> 
> I can use find ./ -name * to list all files, but how do I send them
> through a "grep" to find any occurance of, say, "poohead" within the files
> ????
> 
> 
> Mairhtin O'Feannag
grep -R poohead ./*
0
Reply no_mail4391 (2) 10/9/2003 7:12:45 PM

On Thu, 09 Oct 2003 11:50:06 GMT, Kirk Strauser <kirk@strauser.com> wrote:
> At 2003-10-09T01:59:22Z, Creideiki <creideiki@cfl.rr.com> writes:
> 
>> I usually do it like this
>>
>> find / -type f -exec grep 'poolhead' /dev/null \{\} \;
>>
>> having two files in the arguments for grep will make grep print out the
>> file name it finds the string in.  Of course it'll never find it in
>> /dev/null :)
> 
> So will the '-l' option to grep:
> 
>     $ grep -l foo test.mail
>     test.mail
> 
> And in any case you really want to use xargs instead of -exec .

Yeah, I hadn't known of xargs before now.

But what I was doing with the double file name was make the
find -exec grep act like grep with globbing, where it prints
the name of the file it finds the regular expression *and* prints
the line that matched it.  -l only prints the name.


     $ grep  foo /dev/null test.mail
     test.mail:someline with the string 'foo' in it


0
Reply creideiki (13) 10/9/2003 7:45:18 PM

=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 2003-10-09T19:45:18Z, Creideiki <creideiki@cfl.rr.com> writes:

> But what I was doing with the double file name was make the find -exec
> grep act like grep with globbing, where it prints the name of the file it
> finds the regular expression *and* prints the line that matched it.  -l
> only prints the name.

Oh!  Like the "-H" flag to GNU grep:

    $ grep -H tells wi.4
    wi.4:This tells the pccard system to use PCI interrupts for this odd be=
ast.

=2D --=20
Kirk Strauser
The Strauser Group
Open. Solutions. Simple.
http://www.strausergroup.com/
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/hb2i5sRg+Y0CpvERAnvsAJ9QSJ2JB9BYCBPwjpwQzssZwHIB5ACgkdLk
H0kl6jpgFiSNNh8d64+UipQ=3D
=3D80E/
=2D----END PGP SIGNATURE-----
0
Reply kirk (233) 10/9/2003 8:00:07 PM

> I want to search all the files on my computer for the occurance of a 
> particular string.  

The use of `exec` is one way to do this, but another is this:

find / -type f | xargs grep something

Xargs is one of the *very* cool commands that isn't used as much as it
should be (see lsof).  I am just learning it myself actually.  The
thing about xargs is that the command that comes after it is treated
as if it's being piped to.  So xargs builds a list of input from what
came before it, and then does the command that comes after it for each
item in that list.

You could, for example, find all files owned by a certain person, and
copy them to a directory, etc.

Enjoy.

-danielrm26
0
Reply danielrm26 (8) 10/10/2003 1:22:32 AM
comp.os.linux.misc 33302 articles. 19 followers. Post

22 Replies
82 Views

Similar Articles

[PageSpeed] 19


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Find strings in one file that are not in other file
Suppose I have two files N.txt and O.txt .N contains unique strings that are sorted alphabetically .Similarly O also contains unique strings that are sorted alphabetically . I want to find those strings that are in N.txt but not in O.txt .The condition is that both N and O.txt are very long files and contain only 1 string per line.How can this be done in the most shortest/efficient way??(unix/linux commands ) "jeniffer" <zenith.of.perfection@gmail.com> writes: > Suppose I have two files N.txt and O.txt .N contains unique strings > that are sorted alphabetically .Simila...

Find All only finds in open files if search string contains \n
Found this while running CW 8.3 (IDE v5.1.1 Build 1108) under Mac OS X 10.3.5 on a Quicksilver 2002 G4. The project (Adobe InDesign sample plugin "SnippetRunner" from the InDesign CS 3.01 SDK) has 98 source files and 6 library files. Source files use Unix line end ('\n'). When I did "Find All" for search strings such as "\n(" or "\n:" the search would fail unless the file(s) containing those string were open in the IDE. Not fatal but damn annoying. Anyone else see things like this? In article <steve-F20532.15014919082004@new...

open a text, find a string, and delete everything before this string, resave file.
Hello all, I'm sure this is an easy question. I have a text file with a bunch of variables set into it. I would like to load this file and run it as an .m file so that each of these strings are evaluated in matlab, this is no problem, I can open the file, and save it as an .m file. My problem is that each of the text files has a random number of header lines, that I want to get rid of, this would be easy if the number of headers in each of my files were the same, but it is not. However, the starting point is always the same. So i want to open a text file, and find where it says "m_...

find string in file
Hi, Is there in Xharbour a function to find a string like "glass*" in a file and filter it or create a new file with the found records ? Jos On 31 Gen, 22:56, "J Cuypers" <jos.cuyp...@telenet.be> wrote: > Hi, > Is there in Xharbour a function to find a string like "glass*" in a file and > filter it or create a new file with the found records ? > > Jos UNTESTED use yourdbf COPY FIELDS code,desc FOR "GLASS"$ Upper(desc) TO file.Tmp SDF YOU CAN USE ALSO DELIMITED WITH INSTEAD sdf Did you think about somethi...

find string between files
Hi all, how can I search for a specific string inside a directory (between files) ? Thanks for your help "e.group" wrote: > how can I search for a specific string inside a directory (between files) ? Strings between files? Can you be any more obscure? -am � 2003 Anthony Mandic <r2@hotmail.com> wrote: > "e.group" wrote: > > > how can I search for a specific string inside a directory (between files) ? > > Strings between files? Can you be any more obscure? Yes, he could have posted it in Hebrew. ...

find string in file
Dear all, I have several files containing just one line and each line contains different characters separated by blank spaces: xxxxx/xxx --xx xx --xx xx xxxx xxx xxxx xx/xxxx/x.yyy let say that I would like just to retrieve strings that match the pattern "*yyy", the output should be: xx/xxxx/x.yyy If I do a grep, the whole line is retrieved. How could I retrieve just a single string? Best wishes On Mon, 10 May 2010 06:11:55 -0700 (PDT), Javier Montoya wrote: > Dear all, > > I have several files containing just one line and each line contains > diff...

find string in files
Hello, Can someone give me a simple shell script that search for a specific string in all files ? Same as MS Windows' "Search/Find in file" functionality. Regards, Elias lallous typed (on Fri, Jul 25, 2003 at 11:47:07AM -0700): | | Can someone give me a simple shell script that search for a specific | string in all files ? find / -type f | xargs grep "specific string" /dev/null | less -- JP lallous typed (on Tue, Aug 05, 2003 at 12:23:40AM +0300): | thanks JP, it works. | | can you dissect and explain it please ? Perhaps you have noticed another thread over th...

find a string in files
Hi $ grep -FHrn string /path/ will find occurrences of the string in files recursively, but will also find "stringing" and "strings". how can I limit it to only "string" thanks Gary Wessle wrote: > Hi > $ grep -FHrn string /path/ > will find occurrences of the string in files recursively, but will > also find "stringing" and "strings". > how can I limit it to only "string" > grep -FHwire string /path/ > thanks np P.S.: It's called a word boundary. HTH, -- Stephan Grein, <stephan at stephan mi...

find string in file
Hi friends !! I'm neophite about python, my target is to create a programa that find a specific string in text file. How can do it? Thanks fel On 14 mar, 14:25, fminerv...@gmail.com wrote: > Hi friends !! > > I'm neophite about python, my target is to create a programa that > find a specific string in text file. > How can do it? > > Thanks > fel $ cat text.txt aaa bbb ccc ddd aaa bbb ccc ddd aaa bbb ccc ddd aaa eee bbb eee ccc eee ddd eee $ cat bin/find_string.py import sys file_name=sys.argv[1] searched_string=sys.argv[2] result= [(line_number+1, line) fo...