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@cse.psu.edu>
Subject: Re: [9fans] Acme aborts on a pointless Edit command
Date: Sun, 23 Dec 2007 23:28:16 -0500	[thread overview]
Message-ID: <3B5C3784-0F7A-41AA-9376-7E579254ACD4@mac.com> (raw)
In-Reply-To: <20071224041704.GA14349@dinah>

THE UNIX PROGRAMMING ENVIRONMENT by Kernighan and Pike to the rescue!  
According to Appendix A, to reverse lines,

	g/^/m0

Or, better yet, in rc:

	awk '
	{ x[NR] = $0}
	END {
		for (i = NR; i >= 1; i--)
			print x[i]
	}'

On Dec 23, 2007, at 11:17 PM, Anthony Martin wrote:

> I was feeling obscene and decided to test out stupid
> commands in sam and acme. Here's something I didn't
> expect.
>
> Sam:
> , x g/^/m.	no change to file
>
> Acme (Edit):
> , x g/^/m.	aborts in /sys/src/cmd/acme/ecmd.c:/^move
>
> It aborts because "move overlaps itself" but the
> question I have is, should it work like sam and
> do *visually* nothing at all?
>
>
> Anthony
>
> P.S.
> This came about because I was trying to find a way to
> move lines matching a certain pattern to the beginning
> of a file (like g/pattern/m0 in ed). Is there a nice
> way to do this in sam?
>
> Something that works like the ed command but leaves the
> lines in original order, not reversed, would be even
> better.
>
> -- 
> I spent a night with a blow-up girl and some LSD. -Freeheat


  reply	other threads:[~2007-12-24  4:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-24  4:17 Anthony Martin
2007-12-24  4:28 ` Pietro Gagliardi [this message]
2007-12-24  4:37   ` Anthony Martin
2007-12-24  9:50   ` Rob Pike
2007-12-24  5:25 ` erik quanstrom
2007-12-24 17:24   ` Joel C. Salomon
2007-12-24 17:35     ` Pietro Gagliardi
2007-12-25  1:51       ` [9fans] ipod + plan9 Philipp
2007-12-25  5:20         ` Pietro Gagliardi
2007-12-26 12:52 ` [9fans] Acme aborts on a pointless Edit command roger peppe
2007-12-26 17:52   ` ron minnich
2007-12-27  3:36 ` Rob Pike
2007-12-28  6:08 Joshua Wood

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=3B5C3784-0F7A-41AA-9376-7E579254ACD4@mac.com \
    --to=pietro10@mac.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).