Mailinglist Archive: opensuse (2629 mails)
| < Previous | Next > |
Re: [SLE] grep help
- From: keith@xxxxxxxxxxxxxx (Keith Warno)
- Date: Tue, 16 May 2000 11:30:51 -0400
- Message-id: <000801bfbf4b$b7d36480$9e0a010a@xxxxxxxxxxx>
If you're wanting to grep through multiple files in multiple directories
some levels deep, use a combination of find, grep, and xargs.
For example, my boss wanted to look for a string FOO in all of our sorce
code (.c, .cpp, and .h files). This is accomplished like this (assuming
we're looking in the current dir and below):
keith@develop[pts/7]:~$ find . -type f \( -name \*.c -o \
> -name \*.cpp -o -name \*.h \) \
> -print0 | xargs --null grep FOO
Check the man for find(1), grep(1), and xargs(1)
Ciao,
kw
/* Keith Warno
** Developer & Sys Admin
** http://www.HaggleWare.com/
*/
----- Original Message -----
From: "Samy Elashmawy" <samelash@xxxxxxxxxxxxx>
To: "François Pinard" <pinard@xxxxxxxxxxxxxxxx>
Cc: <suse-linux-e@xxxxxxxx>
Sent: 16 May 2000, Tuesday 05:02
Subject: Re: [SLE] grep help
At 07:43 PM 5/15/2000 -0400, François Pinard wrote:
>Samy Elashmawy <samelash@xxxxxxxxxxxxx> writes:
>
>> I tried grep -r "arch4" /
it only searches the root and nothing below that. I tried grep "arch4" /*
/*/* /*/*/* /*/*/*/*
ant it stopped with an error arguments two long or something.
I was hoping to find the deffinition files that have the size and pixel
lenth of the printer page layoust so I could change them to a custom
setting.
Murphys law ya know
>It works here, running version 2.3. But you need a recent version of
>`grep', I do not remember when the `-r' was added to it. Check with
>`grep --help' to see if `-r' is supported.
>
>--
>François Pinard http://www.iro.umontreal.ca/~pinard
>
>
>
>--
>To unsubscribe send e-mail to suse-linux-e-unsubscribe@xxxxxxxx
>For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
>Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
>
>
--
To unsubscribe send e-mail to suse-linux-e-unsubscribe@xxxxxxxx
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
--
To unsubscribe send e-mail to suse-linux-e-unsubscribe@xxxxxxxx
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
| < Previous | Next > |