Re: [dev] print utility

From: Sam Watkins <>
Date: Tue, 2 Apr 2013 16:29:59 +1100

> e.g. A=/usr/bin B=/bin sed 's/$A/$B/' <in >out # won't work

> I'm also not representative of the sed community, but to suggest that
> this is what people primarily use it for is just ignorant.

Ok perhaps I misjudged that, and I was a bit harsh on sed. Sure, sed is
good at running ed scripts over streams and this is useful, but it is not
good at doing basic text replacement with arbitrary strings. We might
want a separate simple tool for that. But because the complex sed exists,
that simple and basic 'substitute' tool has not been included in unix.

What is the shortest shell command you can write,
that replaces $A with $B in a text stream for any A and B?

Can this be done in one line using sed or awk, or any stock unix tool?

I can do with an ugly line of perl, but won't share that here!

If I'm building a machine, I might want to use bolts.
Generic, good quality bolts. I'd rather not use bolts that can also
function as screws, nails and batteries.
Received on Tue Apr 02 2013 - 07:29:59 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 02 2013 - 07:36:05 CEST