gabriel rosenkoetter on Thu, 10 Oct 2002 22:40:04 -0400 |
On Thu, Oct 10, 2002 at 03:07:05PM -0400, Paul wrote: > I'm impressed anyway. 8^) I usually cheat with "find" and type "find > *|grep something" but that wouldn't do what I wanted. Your find command > does work (without the dash). find(1) and, to an even greater extent, GNU find is a tremendously useful tool that anyone serious about Unix file system use should get to know. It'll save you no end of time in the long run. What it *can't* do is content searches (the way that Apple's Sherlock or MS's whatever-in-Explorer can) which is definitely a limitation, but one that's not totally insurmountable. Say you're looking for a shell script, but haven't a clue where on that 2 TB SAN partition you left it, and also haven't a clue what it's called. (Say, perhaps, that a previous admin wrote it, pointed it out to you in passing, but you didn't take notes on the details. Ahem, Barry.) You're sure it's either a Perl script or a /bin/sh script, and you're sure it calls GNU tar as gtar somewhere inside. If you're me, you'd do something like this (forgive me typos, I'm not testing it): find /foo -type f \( -name \*.sh -o -name \*.pl \) \ -exec echo {} \&\& grep -C gtar {} > /tmp/found -- gabriel rosenkoetter gr@eclipsed.net Attachment:
pgpB3r8klWv8u.pgp
|
|