9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] missing ed's line numbering in sam -d
@ 2009-04-23 15:03 Rudolf Sykora
  2009-04-23 15:17 ` erik quanstrom
  2009-04-28 22:37 ` Russ Cox
  0 siblings, 2 replies; 8+ messages in thread
From: Rudolf Sykora @ 2009-04-23 15:03 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

when using 'sam -d' to remotely edit files I really miss the option to
print line numbers along with lines, like ed's e.g. '1,10n'.

Is there anything like that? Why not?

Thanks
Ruda



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

* Re: [9fans] missing ed's line numbering in sam -d
  2009-04-23 15:03 [9fans] missing ed's line numbering in sam -d Rudolf Sykora
@ 2009-04-23 15:17 ` erik quanstrom
  2009-04-23 15:34   ` roger peppe
  2009-04-28 22:37 ` Russ Cox
  1 sibling, 1 reply; 8+ messages in thread
From: erik quanstrom @ 2009-04-23 15:17 UTC (permalink / raw)
  To: 9fans

you can do this in sam with an external program

; cat /bin/nl
#!/bin/rc

if(~ $#* 0)
	awk '{printf("%4d %s\n", ++lineno, $0);}'
if not for(i)
	awk '{printf("%4d %s\n", ++lineno, $0);}' < $i
; sam -d /lib/volcanoes
1,10>nl
   1 This nice little file came from the Smithsonian.
   2 Doug McIlroy
   3
   4                           SMITHSONIAN INSTITUTION
   5                          GLOBAL VOLCANISM PROGRAM
   6                      NHB MRC 119, Washington, DC 20560
   7
   8                        VOLCANOES OF THE WORLD - 1992
   9
  10
!

- erik



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

* Re: [9fans] missing ed's line numbering in sam -d
  2009-04-23 15:17 ` erik quanstrom
@ 2009-04-23 15:34   ` roger peppe
  2009-04-23 15:42     ` erik quanstrom
  0 siblings, 1 reply; 8+ messages in thread
From: roger peppe @ 2009-04-23 15:34 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

2009/4/23 erik quanstrom <quanstro@quanstro.net>:
> you can do this in sam with an external program

... except the line numbers won't be accurate unless
you're printing lines from the beginning.



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

* Re: [9fans] missing ed's line numbering in sam -d
  2009-04-23 15:34   ` roger peppe
@ 2009-04-23 15:42     ` erik quanstrom
  2009-04-23 16:04       ` roger peppe
  0 siblings, 1 reply; 8+ messages in thread
From: erik quanstrom @ 2009-04-23 15:42 UTC (permalink / raw)
  To: 9fans

On Thu Apr 23 11:36:09 EDT 2009, rogpeppe@gmail.com wrote:
> 2009/4/23 erik quanstrom <quanstro@quanstro.net>:
> > you can do this in sam with an external program
>
> ... except the line numbers won't be accurate unless
> you're printing lines from the beginning.

left as an excercize to the reader.

- erik



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

* Re: [9fans] missing ed's line numbering in sam -d
  2009-04-23 15:42     ` erik quanstrom
@ 2009-04-23 16:04       ` roger peppe
  2009-04-23 16:12         ` erik quanstrom
  0 siblings, 1 reply; 8+ messages in thread
From: roger peppe @ 2009-04-23 16:04 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

2009/4/23 erik quanstrom <quanstro@coraid.com>:
> left as an excercize to the reader.

not possible, i think, as the external program can't
know where the sam selection is coming from.
easier in acme.



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

* Re: [9fans] missing ed's line numbering in sam -d
  2009-04-23 16:04       ` roger peppe
@ 2009-04-23 16:12         ` erik quanstrom
  2009-04-23 16:34           ` John Stalker
  0 siblings, 1 reply; 8+ messages in thread
From: erik quanstrom @ 2009-04-23 16:12 UTC (permalink / raw)
  To: 9fans

On Thu Apr 23 12:06:23 EDT 2009, rogpeppe@gmail.com wrote:
> 2009/4/23 erik quanstrom <quanstro@coraid.com>:
> > left as an excercize to the reader.
>
> not possible, i think, as the external program can't
> know where the sam selection is coming from.
> easier in acme.

totally impossible to do acme -d.

otoh, since . can be known by the
user in sam -d, one could modify the
script so that

	19,29>nl -s19

works as expected.

- erik



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

* Re: [9fans] missing ed's line numbering in sam -d
  2009-04-23 16:12         ` erik quanstrom
@ 2009-04-23 16:34           ` John Stalker
  0 siblings, 0 replies; 8+ messages in thread
From: John Stalker @ 2009-04-23 16:34 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

The underlying problem is that sam is simply not line-oriented.
If you're doing things with a file which is naturally thought
of a series of lines then ed is usually better than sam -d.

--
John Stalker
School of Mathematics
Trinity College Dublin
tel +353 1 896 1983
fax +353 1 896 2282



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

* Re: [9fans] missing ed's line numbering in sam -d
  2009-04-23 15:03 [9fans] missing ed's line numbering in sam -d Rudolf Sykora
  2009-04-23 15:17 ` erik quanstrom
@ 2009-04-28 22:37 ` Russ Cox
  1 sibling, 0 replies; 8+ messages in thread
From: Russ Cox @ 2009-04-28 22:37 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, Apr 24, 2009 at 1:03 AM, Rudolf Sykora <rudolf.sykora@gmail.com> wrote:
> when using 'sam -d' to remotely edit files I really miss the option to
> print line numbers along with lines, like ed's e.g. '1,10n'.
>
> Is there anything like that? Why not?

no.  because for remotely editing files,
you're supposed to use sam -r.

russ


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

end of thread, other threads:[~2009-04-28 22:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23 15:03 [9fans] missing ed's line numbering in sam -d Rudolf Sykora
2009-04-23 15:17 ` erik quanstrom
2009-04-23 15:34   ` roger peppe
2009-04-23 15:42     ` erik quanstrom
2009-04-23 16:04       ` roger peppe
2009-04-23 16:12         ` erik quanstrom
2009-04-23 16:34           ` John Stalker
2009-04-28 22:37 ` Russ Cox

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