Yesterday I used uuencode and uudecode for the first time in ages. It worked!

Before I discovered that I had uudecode available, I tried to use xxd to encode and awk to decode.

But my awk one-liner did everything right except never outputting any zero bytes.

This was on BSD 2.11 on a PDP 11/84... it's a machine called snake and you can use it too, just go to

Anyhow, I successfully computed 100 digits of Pi using BBC Basic!

older awk implementations 

This oneliner shows that older awks won't printf a zero byte... any way to make it do that?

awk 'BEGIN{printf("%c%c%c\n",65,0,66);exit}' | od -x

Tested on BSD 2.11 and SunOS 4.1.1 and Unix System V R3 (all at living computers)

@EdS thank you for using "snake" at Living Computers!

@EdS I know I used to do it "all the time" but I'll be damned if I can remember why.

older awk implementations 

@EdS I find that fascinating, and I think we can all see where it came from.

older awk implementations 

@EdS Well, now you've got Beeb BASIC there, how about VDU 0 - does that work?

older awk implementations 

Now I have BBC Basic I'm no longer in need! (In fact, uudecode got me out of the hole.)

What I might have done is write the hex-to-binary in C, but of course awk was my first thought.


Sign in to participate in the conversation
Mastodon @ SDF

"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko