9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Dan Cross" <crossd@gmail.com>
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
Date: Sun, 17 Jun 2007 03:27:55 -0400	[thread overview]
Message-ID: <aa7e41150706170027n1779864eq57b8f147912ead00@mail.gmail.com> (raw)
In-Reply-To: <45609539-34EC-4F53-AECF-769F401EC6F0@tinker.com>

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 <kim@tinker.com> 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
>


      parent reply	other threads:[~2007-06-17  7:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-10 19:32 Kim Shrier
2007-06-10 19:44 ` Kris Maglione
2007-06-10 19:44 ` erik quanstrom
2007-06-10 20:10   ` Kris Maglione
2007-06-11 18:09     ` Federico Benavento
2007-06-17  7:27 ` Dan Cross [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa7e41150706170027n1779864eq57b8f147912ead00@mail.gmail.com \
    --to=crossd@gmail.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).