Re: [dev] print utility

From: markus schnalke <meillo_AT_marmaro.de>
Date: Tue, 02 Apr 2013 13:19:51 +0200

[2013-04-02 15:36] Sam Watkins <sam_AT_nipl.net>
> I reckon by far the most common thing people do with sed is to replace
> one (sort of) string with another. But even this "core sed business"
> is ridiculous with sed.
>
> e.g. A=/usr/bin B=/bin sed 's/$A/$B/' <in >out # won't work
>
> Changing delimiters doesn't help for the general case. I would have to
> escape any input string before sed can handle it, which is more difficult
> than writing a better substitute process.
>
> sed is over-complex and so it's stupid even at its simplest core business.
>
> I would like rather:
>
> sub "$A" "$B" <in >out
>
> etc. More binaries perhaps, but at least they are sane.

Funny to see this proposal. Never heard of gres(1), huh? [0][1]
It was a ripped-out-of-ed tool like grep(1). The name stands for
``g/re/s///'' as grep stands for ``g/re/p''. It did exactly what you
want sub(1) to do. Still at Bell Labs times gres died out when sed(1)
became available. ;-) Seemingly, those that shaped Unix and its
philosophy had no objections to its death.

I can't recall from mind where I've read this story, possible in
``Software Tools'' or in ``The UNIX Programming Environment''.


meillo


[0] http://www.mkssoftware.com/docs/man1/gres.1.asp
[1] http://docstore.mik.ua/orelly/unix/sedawk/ch03_02.htm#AUTOID-2409
Received on Tue Apr 02 2013 - 13:19:51 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 02 2013 - 13:24:05 CEST