9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Pietro Gagliardi <pietro10@mac.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] acme g/$/ funny
Date: Thu, 17 Jul 2008 09:07:52 -0400	[thread overview]
Message-ID: <F683F1B8-6821-4227-A06D-069CDBDC3434@mac.com> (raw)
In-Reply-To: <df49a7370807170303t38cfd85euf8e85d7ff85de32c@mail.gmail.com>

On Jul 17, 2008, at 6:03 AM, roger peppe wrote:
> Edit ,x/.*/g/$/a/foo/
>
> shouldn't this append "foo" after every line?
>
> sam gives slightly different behaviour here
> (but still questionable) - it appends "foo" after
> every empty line.
>
> is this actually a bug, or have i misunderstood the
> way that '$' is meant to work?
>
> it does seem strange that in the following edit
> command, the guard never matches anything.
>
> Edit ,x/foo$/g/foo$/d
>

You misunderstood how Pike regexps work, and it's a bug in sam. The
pattern /./ matches everything EXCEPT a newline, which would be
matched with $. The guard, then, should never work, as the following
proves:

,x/.*/g/$/p

As expected, no output (for sam too). So acme is acting correctly. Why
sam does something, then, with a// is beyond me (a long undiscovered
bug, perhaps?).

The following worked for me for both sam and acme:

,x/$/a/foo/

On Jul 17, 2008, at 8:44 AM, Charles Forsyth wrote:
> Edit ,x/.*\n/g/\n/a/foo
That appends foo at the beginning of the next line. Try i/foo/.




  parent reply	other threads:[~2008-07-17 13:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-17 10:03 roger peppe
2008-07-17 12:44 ` Charles Forsyth
2008-07-17 13:07 ` Pietro Gagliardi [this message]
2008-07-17 14:01   ` roger peppe
2008-07-17 14:43   ` Russ Cox

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=F683F1B8-6821-4227-A06D-069CDBDC3434@mac.com \
    --to=pietro10@mac.com \
    --cc=9fans@9fans.net \
    /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).