9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] acme/sam internal/external command combination?
@ 2005-06-13 12:57 Axel Belinfante
  2005-06-13 14:10 ` Steve Simon
  2005-06-13 14:20 ` Russ Cox
  0 siblings, 2 replies; 4+ messages in thread
From: Axel Belinfante @ 2005-06-13 12:57 UTC (permalink / raw)
  To: 9fans; +Cc: sam-fans

[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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-06-14 16:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-13 12:57 [9fans] acme/sam internal/external command combination? Axel Belinfante
2005-06-13 14:10 ` Steve Simon
2005-06-13 14:20 ` Russ Cox
2005-06-14 16:10   ` Rob Pike

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).