[comp.unix.wizards] A Challenge to Sed Adepts

root@chessene.UUCP (Mark Buda) (05/28/89)

Here's a couple problems, possibly in order of increasing difficulty:

1) Write a sed script that takes as input decimal numbers, one to a line,
and converts them to hexadecimal. Or the other way around.

2) Write a sed script that takes as input decimal numbers, one to a line,
and adds them up. It can produce the final total, a running total, or
whatever. As long as it adds them up.

3) Same as #2, but do it with binary numbers.

4) Write a sed script that takes as input two decimal numbers, one to a line,
and multiplies them. (And outputs the product, of course.) Or prove that it
can't be done.

5) Same as #5, but do it with binary numbers.

If anybody gets #4, I will be truly amazed. (If *I* get #4, I will be even
more truly amazed.) Programs that fail due to limitations of sed will be
considered valid (if they actually work). Mail your submissions to the address
given below, or, if it bounces (as it very well might) consider posting them.
The winner for each problem is the person with the first correct solution.
In the event of not being really sure who was first, it's a tie.

No prizes, sorry :-)

(What a big waste of time this is)

Mark Buda
hermit@chessene.uucp
hermit%chessene.uucp@uunet.uu.net
...!rutgers!bpa!vu-vlsi!devon!chessene!hermit
devon.lns.pa.us!chessene!hermit

ip@me.utoronto.ca (Bevis Ip) (05/28/89)

This is the first time I post flame in the past few years, but I just can't
resist this anymore.  There is no point in this exercise at all; I think
people should try to resist their urge to do such nonsense--well, at least
the poster admitted himself that it's a waste of time.  I wouldn't blame him
on wasting bandwidth because bandwidth has been wasted one way or another
anyway.

I appreciate intelligent questions and answers, but not nonsense that people
thought up like the one posted, awk is a better tool for this application,
for example.  Probably it's the format of the posting that upset me, I will
definitly not be flaming if it's been posted like "I have to do this in sed
because of whatsoever ...".  If the poster is trying to bring out a
discussion on sed through the posting, I think there's a better way to
present it.

Thank you for bearing with me.

bevis
-- 
Bevis Ip                <>  ip@me.utoronto.ca, ip@me.toronto.edu
University of Toronto   <>  {pyramid,uunet}!utai!me!ip
Mechanical Engineering  <>  {allegra,decwrl}!utcsri!me!ip