[SunHELP] Grep Help

DAUBIGNE Sebastien - BOR sunhelp at sunhelp.org
Wed Sep 19 12:03:39 CDT 2001


Note that  :

	find start_dir -type f | xargs egrep '(a|b|c|d)'=20

is much faster than :

	find start_dir -type f -exec egrep '(a|b|c|d)' {} /dev/null \;

because with the former you spawn 1 egrep process per file, as with the =
fist
one you spawn only 1 egrep process per  =
(LINE_MAX/average_filename_length)
files.


Try both with 10000 files and you'll see the difference.

(man xargs)

---
Sebastien DAUBIGNE=20
sebastien.daubigne at sema.fr <mailto:sebastien.daubigne at sema.fr>  - (+33)
(0)5.57.26.56.36
Sema Global Services - AFM/DW/Pessac

	-----Message d'origine-----
	De:	Kovalev, Ivan [SMTP:Ivan.Kovalev at tfn.com]
	Date:	mardi 18 septembre 2001 23:57
	=C0:	'sunhelp at sunhelp.org'
	Objet:	RE: [SunHELP] Grep Help

	rgrep is fine for subdirs, but you can have your criterias OR-ed
using
	egrep.

	your line should look something like this

	find start_dir -type f -exec egerep '(a|b|c|d)' {} /dev/null \;

	This will go down recursively and also print the name of the file
where a or
	b or c or d is found.

	Ivan

	-----Original Message-----
	From: Fogg, James [mailto:JFogg at vicinity.com]
	Sent: Tuesday, September 18, 2001 4:44 PM
	To: 'sunhelp at sunhelp.org'
	Subject: RE: [SunHELP] Grep Help


	I highly recommend rgrep (recursive grep), esp. since it can search
	subdirectories.

	> -----Original Message-----
	> From: Shain Miley [mailto:smiley at tvdata.com]
	> Sent: Tuesday, September 18, 2001 6:52 PM
	> To: sunhelp at sunhelp.org
	> Subject: [SunHELP] Grep Help
	>=20
	>=20
	> Hi,
	> I need to search for about 15 things (list of ip addresses=20
	> and hostnames) in a file useing grep.  Do I have to use grep=20
	> 15 different times or can I give
	> multiple search options to one grep command?  I tried 'grep=20
	> 'a b c d e' file' but I get an error:   grep: RE error 41: No=20
	> remembered search string.  Any
	> ideas?  i have tried using examples I found on the web but it=20
	> looks like that does an exact search or something other than=20
	> what I need.  Thanks.
	>=20
	> Shain
	>=20
	> _______________________________________________
	> SunHELP maillist  -  SunHELP at sunhelp.org
	> http://www.sunhelp.org/mailman/listinfo/sunhelp
	>=20
	_______________________________________________
	SunHELP maillist  -  SunHELP at sunhelp.org
	http://www.sunhelp.org/mailman/listinfo/sunhelp
	_______________________________________________
	SunHELP maillist  -  SunHELP at sunhelp.org
	http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list