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

* Re: [9fans] acme/sam internal/external command combination?
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Steve Simon @ 2005-06-13 14:10 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

I lied, I appologise. NetUserEnum2 works fine against win2k3.

However another one for your To-do list of errata, I found
SessionEnum in the samba code but it is a priviledged call
giving "user has insufficent priviledge" if you try to
use infolevel 1. However infolevels zero and ten are available
to authenticated users, and level 10 has enough info for my needs,
the sytuctures are documented in MSDN (google is your friend).

-Steve

[-- Attachment #2: Type: message/rfc822, Size: 4771 bytes --]

From: Axel Belinfante <Axel.Belinfante@cs.utwente.nl>
To: 9fans@cse.psu.edu
Cc: sam-fans@hawkwind.utcs.toronto.edu
Subject: [9fans] acme/sam internal/external command combination?
Date: Mon, 13 Jun 2005 14:57:57 +0200
Message-ID: <200506131257.j5DCvvw28273@zamenhof.cs.utwente.nl>

[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

* Re: [9fans] acme/sam internal/external command combination?
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Russ Cox @ 2005-06-13 14:20 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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


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

* Re: [9fans] acme/sam internal/external command combination?
  2005-06-13 14:20 ` Russ Cox
@ 2005-06-14 16:10   ` Rob Pike
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Pike @ 2005-06-14 16:10 UTC (permalink / raw)
  To: Russ Cox, Fans of the OS Plan 9 from Bell Labs

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


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