get it script-ed(1)
===================
ed(1) is the standard Unix editor. Deal with it. ed(1) is the
source of most of the grace and beauty you can admire in a Unix
system. ed(1) is where the Unix regexp syntax originated. grep(1) was
indeed ed(1). sed(1) is just ed(1) on steroids, working on streams
of characters. vi(1) was ed(1) once. vim(1) has never been vi(1),
and surely it is not vi(1) any more, but that's another story.
ed(1) is no like any other text editor. The similarity between ed(1)
and emacs(?) ends before you get to the "e". You can't really call
nano(1) an editor, can you?
You cannot really call yourself a Unix guru if you don't know
ed(1). And in any case, you should not call yourself a Unix guru at
all, as you probably are not one.
You have the chance to redeem your soul, and walk again on the True
Unix Path, by getting your hands dirty with ed(1). But you shall
abide totally to the First Law of Unix: Read The Friendly Manpage,
and when you have read it, Read It Again For Frienship's Sake!
You will find all the information you need in the man(1) page of ed(1).
If your operating system does not have ed(1) installed, ask yourself
why you are using it. If your operating system has ed(1) installed
but does not have a man(1) page for ed(1), then bloody hell why do
you call it an operating system?
If you are a total beginner at ed(1), and only *after* you have read
and re-read the ed(1) man(1) page, you might find it useful to have
a look at the ed(1) tutorial available at:
gopher://katolaz.net/0/ed_tutorial.txt
But really, the ed(1) man(1) page is the only thing you need.
This is an easy challenge: you have to do something useful using
ed(1). We know it might be hard to come up with something, so we
have prepared a list of simple tasks you might want to try before
embarking on something more serious. Each task is worth some points,
and each participant will be judged on the basis of all the code
it submits. In other word, you can submit any number of ed(1)-based
scripts, and them will be judged altogether.
The aim of this game is to do useful stuff with ed(1), so in principle
you should only use ed(1) or ed(1)-based scripts to perform the
selected task. You can decide to make the job easier by reverting to
sed(1), grep(1), or some other standard unix tool, but maybe consider
if the same thing could be done in ed(1) instead. We are also looking
for creative uses of ed(1), so get fancy and crack through it.
List of simple tasks
====================
- write a head(1)
- write a tail(1)
- write a wc(1)
- write a simple nl(1)
- write a more-or-less simple more(1) or less(1)
- write a simple grep(1) (possibly incremental?)
As an example, we have included here a simple version of cat(1)
written in ed(1). See how easy it is?
#!/bin/sh
printf ",p\nQ\n" | ed -s $1
Now, just try your hand at some of those simple task, and then crack
on something more exciting/challenging/fun/clever/useless.
Sumbissions can be sent to script-ed@katolaz.net by end of January
1st 2023 UTC. Let's start the new year with some sane and clever
hacking. get-it-script-ed(1)!
(This file was written and formatted in ed(1), obviously!)
Response:
text/plain