From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Sun, 17 Jun 2007 03:27:55 -0400 From: "Dan Cross" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] Is there a Plan 9 equivalent of the find command In-Reply-To: <45609539-34EC-4F53-AECF-769F401EC6F0@tinker.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <45609539-34EC-4F53-AECF-769F401EC6F0@tinker.com> Topicbox-Message-UUID: 7fee8428-ead2-11e9-9d60-3106f5b1d025 Back in the day, I wrote two commands: walk and sor. Walk was somewhat similar to Russ's lsr command (these days, lsr would probably be better; the only additional thing walk offered was the ability to limit the depth of searching via an option). Sor took other commands as arguments; for each filename that it read (presumably generated by walk), it would apply each test successively; if one returned `true' it would print out the resulting filename. (sor, incidentally, stands for `stream or'). The idea behind find, when you step back a little bit, is to produce some list of files (or otherwise do something interesting with them) after applying a set of predicates to them. The predicates can be strung together into aribrary sequences that form filters based on the boolean value of evaluating the predicates for each file that find visits. Well, in Plan 9, we form filters that reduce lists using pipes, and sor was just a convenient way to compute the boolean or of a bunch of predicate evaluations. It worked out, I thought, reasonably well, but never made it into the distribution; I guess no one else saw the point. But, if you search through the 9fans archives, you can probably find the tools (and they're in my contrib directory on sources). I still thing it's mostly an improvement. - Dan C. On 6/10/07, Kim Shrier wrote: > This is probably me just stuck in the UNIX mind set again. I have > looked through the commands and I don't see anything that does what > find does. What I am trying to do is look in a directory that has > many files and subdirectories and find any file that contains a string. > In UNIX, I would do something like this. > > find . -type f -exec grep some_pattern {} \; -print > > What is the Plan 9 way? > > Thanks, > Kim >