The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] ed(1) and Pipes.
@ 2017-11-15 12:36 Ralph Corderoy
  0 siblings, 0 replies; 3+ messages in thread
From: Ralph Corderoy @ 2017-11-15 12:36 UTC (permalink / raw)


Hi,

ed(1) pre-dates pipes.  When pipes came along, stderr was needed, and
lots of new idioms were found to make use of them.  Why didn't ed gain a
`filter' command to accompany `r !foo' and `w !bar'?

To sort this paragraph, I

    ;/^$/w !sort >t
    ;/^$/d
    -r t

I'd have thought that filtering was common enough to suggest a `^'
command with an implied `!'?  (Not `|' since that was uncommon then.)

ex(1) has `!' that filters if applied to a range of lines, and this
carries through to vi's `!' that's often heavily used, especially when
the "file" is just a scratch buffer of commands, input, and output.

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy


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

* [TUHS] ed(1) and Pipes.
  2017-11-15 22:16 Norman Wilson
@ 2017-11-18 16:09 ` Ralph Corderoy
  0 siblings, 0 replies; 3+ messages in thread
From: Ralph Corderoy @ 2017-11-18 16:09 UTC (permalink / raw)


Hi Norman,

> > ed(1) pre-dates pipes.  When pipes came along, stderr was needed,
> > and lots of new idioms were found to make use of them.  Why didn't
> > ed gain a `filter' command to accompany `r !foo' and `w !bar'?
>
> I sometimes wonder that too.
>
> When I use `ed,' it is usually really qed, an extended ed written by
> the late-1970s UNIX crowd here at U of T.
...
> -- The ability to send part or all of a buffer to a shell command, to
> read data in from a shell command, or to send data out and replace it
> with that from the shell command:
>
>     >mail user ...
>     <ps -ef
>     |tr a-z A-Z

Thanks for the pointer.

I dug a little.  7th Ed. ed doesn't have the `:[rw] !foo' form.  It was
in "PDP-11 3+2", 1983-01, in filename().
http://minnie.tuhs.org/cgi-bin/utree.pl?file=pdp11v/usr/src/cmd/ed/ed.c
Xqt is the global flag that says the `!' was present.

By the time of ex, that did have a filter, the `:w !foo' applied the
`:se nu list' settings to the output of the command, and ex also appends
a LF if the command's output doesn't end with one.  The effect, if not
the implementation, is as if the command's output was in a temporary
buffer than was `%p'-ed.  Here's ex-reimplementation nvi 1.79's attempt
at POSIX's
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html#tag_20_40_13_48

    :se nu list
    :a
	 1  foo	bar
	 2  xyzzy
	 3  .
    :w !head -c 10
    foo^Ibar
    xy
    !

So the line numbers are missing, but it's partly done the `se list' by
showing the tab, though `$' to mark the EOF is missing, and it has added
the LF.

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy


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

* [TUHS]  ed(1) and Pipes.
@ 2017-11-15 22:16 Norman Wilson
  2017-11-18 16:09 ` Ralph Corderoy
  0 siblings, 1 reply; 3+ messages in thread
From: Norman Wilson @ 2017-11-15 22:16 UTC (permalink / raw)


Ralph Corderoy:

  ed(1) pre-dates pipes.  When pipes came along, stderr was needed, and
  lots of new idioms were found to make use of them.  Why didn't ed gain a
  `filter' command to accompany `r !foo' and `w !bar'?

===

I sometimes wonder that too.

When I use `ed,' it is usually really qed, an extended ed
written by the late-1970s UNIX crowd here at U of T.  (Rob
Pike, Tom Duff, David Tilbrook, and Hugh Redelmeier, I think.)

qed is something of a kitchen sink, full of clumsy programmability
features that I never use.  The things that keep me using it are:

-- Multiple buffers, each possibly associated with a different
file or just anonymous
-- The ability to copy or move text (the traditional t and m
commands) between buffers as well as within one
-- The ability to send part or all of a buffer to a shell command,
to read data in from a shell command, or to send data out and
replace it with that from the shell command:

>mail user ...
<ps -ef
|tr a-z A-Z

I use the last quite often; it makes qed sort of a workbench for
manipulating and mining text.  One can do the same with the shell
and temporary files, but using an editor buffer is much handier.

sam has similar abilities (but without all the needless programmability).
Were sam less clumsy to use in its non-graphical mode, I'd probably
have abandoned qed for sam.

Norman Wilson
Toronto ON (for real now)


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

end of thread, other threads:[~2017-11-18 16:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-15 12:36 [TUHS] ed(1) and Pipes Ralph Corderoy
2017-11-15 22:16 Norman Wilson
2017-11-18 16:09 ` Ralph Corderoy

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