Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

find string in files

0 views
Skip to first unread message

lallous

unread,
Jul 25, 2003, 2:47:07 PM7/25/03
to
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

Jean-Pierre Radley

unread,
Jul 25, 2003, 3:08:01 PM7/25/03
to
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

to...@aplawrence.com

unread,
Jul 26, 2003, 6:35:03 AM7/26/03
to

While not a bad answer, it's incomplete and not efficient. I have a more complete
answer at http://www.aplawrence.com/SCOFAQ/scotec6.html#recursivegrep which
includes a nice Perl script from Bill Campbell and John Dubois' advise on
Glimpse.

--
to...@aplawrence.com Unix/Linux/Mac OS X resources: http://aplawrence.com
Get paid for writing about tech: http://aplawrence.com/publish.html

lallous

unread,
Aug 4, 2003, 5:23:40 PM8/4/03
to
thanks JP, it works.

can you dissect and explain it please ?

Elias


Jean-Pierre Radley

unread,
Aug 4, 2003, 5:33:58 PM8/4/03
to
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 the last four or five
days, in this newsgroup, regarding "Merge", where Tony and Bela and
I have pointed out that it is necessary to provide some context in
Usenet messages.

If you want me to explain "it", then you must tell me what "it" is.
While I pride myself on having a pretty decent memory, nothing requires
me to remember what sort of "it" I may have provided yesterday, or last
week, or last month.

It is *your* responsibilty to provide some some context, which is
satisfied by (minimal, please!) quoting of prior messages. Neither I
nor anyone else is being paid to dig through prior postings to find out
what was said in them.

As it is, your message is floating around with no references, no quotes,
no anchor, no context; it is a waste of bytes and a waste of time.

--
JP

lallous

unread,
Aug 5, 2003, 2:25:16 AM8/5/03
to
Hello JP,

You have a point....
Now I realized that your news reader doesn't show you the messages in a tree
like structure, if that wasn't the case then you could have just see your
previous post and my original post just below each other. (same as Google
Groups display)

The 'it' referes to this expression:


find / -type f | xargs grep "specific string" /dev/null | less

But nevermind though, I figured it out.

Regards,
Elias

to...@aplawrence.com

unread,
Aug 5, 2003, 7:23:52 AM8/5/03
to
lallous <lal...@lgwm.org> wrote:
>Hello JP,

>You have a point....
>Now I realized that your news reader doesn't show you the messages in a tree
>like structure, if that wasn't the case then you could have just see your
>previous post and my original post just below each other. (same as Google
>Groups display)

AAARGH!

No. That is NOT NECESSARILY TRUE.

First: News articles expire. With the advent of very large hard drives,
servers keep articles around longer than they used to, but you
cannot assume that anyone has a particular message.

Second: News articles get to servers late, out of sequence and sometimes
never at all. News is much faster and more reliable than it ever was,
but you cannot assume that anyone has a specific message or that the
messages are in the same order you see them.

Third: Some people read News by email gateways or other indirect means.
Everything above applies to them in spades.

We all have different views of the world. Nowhere is that more true than
in the world of News.

Jean-Pierre Radley

unread,
Aug 5, 2003, 10:34:04 AM8/5/03
to
lallous typed (on Tue, Aug 05, 2003 at 09:25:16AM +0300):

| Hello JP,
|
| You have a point....
| Now I realized that your news reader doesn't show you the messages in a tree
| like structure, if that wasn't the case then you could have just see your
| previous post and my original post just below each other. (same as Google
| Groups display)

You're wrong. I get the newsgroup as email, and since I use mutt, I
assuredly see messages in a tree-like structure. But I delete most of
them after I've read them.

--
JP

Bob Meyers

unread,
Aug 5, 2003, 8:57:43 PM8/5/03
to

"Jean-Pierre Radley" <j...@jpr.com> wrote in message
news:2003080421...@jpradley.jpr.com...

> lallous typed (on Tue, Aug 05, 2003 at 12:23:40AM +0300):
> | thanks JP, it works.
> Neither I
> nor anyone else is being paid to dig through prior postings to find out
> what was said in them.

Actually, I occassionally, hopefully get paid to "dig through prior
postings" :)

I tell clients comp.unix.sco.misc is my biggest trade secret. I even give
them the link and show them how to look. Fortunately most still hire me to
read it for them.


0 new messages