9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Rob Pike <robpike@gmail.com>
To: Russ Cox <russcox@gmail.com>,
	Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] acme/sam internal/external command combination?
Date: Tue, 14 Jun 2005 09:10:02 -0700	[thread overview]
Message-ID: <7359f049050614091033d9eb34@mail.gmail.com> (raw)
In-Reply-To: <ee9e417a05061307205b226960@mail.gmail.com>

  Edit y/a/d
  Edit $=
is slightly more direct and slightly more obscure.

-rob

On 6/13/05, Russ Cox <russcox@gmail.com> wrote:
> Doesn't answer the general question very nicely but:
> 
> Edit x/[^a]/d
> Edit $=
> 
> or
> 
> !>/tmp/a
> Edit x/a/ |cat >>/tmp/a
> !wc /tmp/a
> 
> 
> 
> On 6/13/05, Axel Belinfante <Axel.Belinfante@cs.utwente.nl> wrote:
> > [cross-posting to sam-fans where this is more appropriate,
> >  although that has been silent for quite a while]
> >
> > I can count the number of ``a'' characters in
> > ``dot'' (current selection) in acme using
> >
> >         Edit x/a/p
> >
> > which prints all ``a'' from ``dot'' in window +Errors
> > and the selecting the aaaa string in +Errors and
> > running >wc on it.
> >
> >         Edit x/a/ > wc
> >
> > runs wc for each match of ``a'' which is not what
> > we want (we want to run wc only once, on all matched ``a'').
> >
> > Is there a (more) direct way to do this, or to access the
> > characters printed by the ``p'' command of above ``Edit'',
> > e.g. something to the effect of
> >
> >         (Edit x/a/p)| wc
> >
> > (and if so, what would be the sam equivalent?)
> >
> >
> > I could imagine a command sequence that first
> > ``destructs'' dot to contain the aaaaa string
> > and then runs >wc on that, but after that the
> > original contents should be restored, so that
> > is not a very good solution.
> >
> >
> > I think the more general question is: to what
> > extent is it possible (or useful) to mix internal
> > sam/acme commands (in particular those for
> > selecting/matching/looping) with external ones like wc,
> > or is the solution to not try to use acme/sam
> > commands for ``preprocessing'' (selecting),
> > but instead use something external,
> > like sed or awk, on the whole selection?
> >
> >
> > Just trying to learn,
> > Axel.
> >
>


      reply	other threads:[~2005-06-14 16:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-13 12:57 Axel Belinfante
2005-06-13 14:10 ` Steve Simon
2005-06-13 14:20 ` Russ Cox
2005-06-14 16:10   ` Rob Pike [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=7359f049050614091033d9eb34@mail.gmail.com \
    --to=robpike@gmail.com \
    --cc=9fans@cse.psu.edu \
    --cc=russcox@gmail.com \
    /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).