Re: encapulating a find function in a script
Mike Castle <[email protected]> Fri, 16 Jan 2004 12:09:37 -0800
| Newsgroups | gmane.linux.console |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jan 16, 2004 at 11:53:49AM -0800, [email protected] wrote: > > You may also find that using xargs instead of -exec is much faster > > (fewer fork/execs). > > > > Something like: > > > > find "$1" -name "$2" -print0 | xargs -0 grep -H "$3" > > > > mrc > > -- > > Thanks! Tried it - works great. Runs two or three times as fast > and with half as many page faults. Just remember that the -print0 and -0 are GNU extensions. If you work on other OS's, you may need to look at going back to -exec, or see if they offer any similar extensions. mrc -- Mike Castle [email protected] www.netcom.com/~dalgoda/ We are all of us living in the shadow of Manhattan. -- Watchmen fatal ("You are in a maze of twisty compiler features, all different"); -- gcc - To unsubscribe from this list: send the line "unsubscribe linux-console" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html