Pinned post
Pinned post

So, I have a question for the ed(1) crowd:

Is there a way to do the following:

w !somecommand >tempfile
r tempfile

Without having to use an intermediary file to capture the output of the command?

#AskFedi #ed #ed1 #unix

Had a weird dream last night where a few friends were asking me to help them install and start using ed(1), the standard Unix line-oriented editor.

With autumn officially here in the northern hemisphere. that means it's pumpkin-spice $EDITOR season:

$ ed -p "🎃 " file.txt

A simplified history of regular expressions:

- In 1951, Stephen Kleene invented regular expressions.

- In 1966, Ken Thompson built the first software implementation of regular expressions, in the QED text editor for CTSS. UNIX ed is a cut down version of QED, popularizing the tradition of regular expressions in editors. grep started as a standalone version of the engine from ed. em, ex, vi, and vim evolved from ed.

- In 1987, Larry Wall spread regular expressions to the next generation of programmers through Perl. Gravely, it uses backtracking, spreading terrible performance for decades. It derives its engine from the rn newsreader, which derives it from Gosling Emacs. James Gosling told me he wrote it from scratch.

- In 2010, Russ Cox, having spent time at Bell Labs, rejected backtracking and built RE2, a fast and scalable engine, generalized from work on Google Code Search. Its ideas have spread to Go regexp and Rust regex, a new generation of engines. These engines dynamically select between specialized matchers, depending on the pattern.

- Since 2025, Ian Erik Varatalu has been researching regular expressions for his PhD and has produced a fast engine using symbolic derivatives. It implements seldom-included intersection and complement and efficiently implements lookaround, which had been exclusive to backtracking engines.

#unix #computerscience

Show thread

@cks Yes we also had way too many users on that poor old PDP-11/45 so no screen editors. I got really good at 'ed'. Sad since I had used EDT on a VT-100 and that editor was sweet!

I learned today that POSIX specifies a tool designed to assist you in reviewing & modifying LLM-generated code. In typical Unix fashion, they shortened "reviewing & modifying" to just two letters:

$ rm code.rs

It even has command-line options to [r]ecursively [f]ix whole directories of LLM-generated code:

$ rm -rf project/

It’s interesting that, as time passes, I grow my assortment of ed(1) scripts that optimize my workflows. Scripts that are not transferrable to e.g. #Emacs. But easy to write and integrate in The True Unix Editor.

These scripts are really useful, like an interactive narrowing grep I just wrote!

So I have perfect scripts and ed(1) versus Turing-complete Emacs and useless vi(m).

As time passes, I seem to gravitate towards ed(1).

Let’s see where that gets me.

CC @ed1conf

I got #linux 7.2 booting on my #Palm IIIxe and #Handspring #Visor! #nommu now to get my graffiti workalike working properly. (The stowaway keyboard works great for now. #ed is perfect on the 32x20 char fbcon) #busybox #buildroot. (See github.com/jsmemfault/uclinux)

@aartaka I tried ed(1) today and didn't hate it, what have you got me into!! :neofox_sign_aaa:

ed +2 quotes.txt
.
HACK THE WORLD!!!

en.wikipedia.org/wiki/Ed_(text

#ed

@svw
For some of us, it was a natural and desirable progression, without trauma, starting with ed, moving on to ex, and then getting access to a monitor (not a paper based terminal) and finding out that there was a visual screen based mode in ex, aka vi. :-)

Emacs came later.

#Emacs #Vi

A happy ed(1) day to all who celebrate

$ date +"obase=16; %j" | bc

I don't count that maniac who thinks ed(1) is the only editor a *real* sysadmin needs. --TLS Mastery

My workshop at LRC on playing with UNIX V4 was a great success!

Everyone loved the teletype and terminal. In the manner of the day, I gave manuals to teach the system and ed (@ed1conf), and we now have a cohort of new ed users. A few groups solved or got close to solving my challenge of backporting the obfuscated mullender.c program from V7 to V4. Surprisingly with a dozen or so people on at once, UNIX handled the load fantastically.

#unix #retrocomputing #vintagecomputing

@nixCraft

If your IDE isn't shell job-control running ed(1) over a serial dial-up line into a BSD prod box with uptime measured in years, are you even programming?

So I wanted to share with you this little project of mine. I delved into "retro-necromancy" and reanimated one very old UNIX utility called ile written by Robert Pendleton in 1988. I found it on one of the Walnut Creek source code CDs from 1994.
What it does is simply works like an input line editor (hence ile) for shells and programs that do not support interactive line editing. To put it simply, it adds Emacs-style keybindings like ^A, ^E, ^K, ^U and so on and command history that you can easily navigate.
Of course, these days it's hard to find a shell that doesn't support line editing.
But this little tool can still be usable, for example, with ed. It's nice to have Emacs-style editing in ed.
It can work like shell replacement or just run like a "middleman" between any given program. It respects terminal settings and doesn't get in a way. Keybindings are configurable.
Needless to say, the code from 1988 wouldn't run on any modern system. It was written in K&R style because there was no ANSI C standard yet! And #UNIX was quite a different beast back then.
So I ported it to modern systems, rewrote outdated bits (like sgttyb ioctls and brutal utmp handling).
Currently it builds and runs on #Linux, #OpenBSD, #FreeBSD and #NetBSD. Hopefully without too much bugs.
You can find it on Codeberg:
codeberg.org/chesheer/ile

inspired by @ed1conf I am going to try using only ed today.

(I can always come back to emacs using !emacsclient -nw if I really need to do so.)

#emacs #ed

Apparently has a builtin/plugin "run a program at a given time" functionality.

Fortunately POSIX already provides an at(1) command so if you find yourself editing in ed(1) and want to schedule a task:

$ ed file.txt
3141
! echo "play alert.mp3 | at "+20 minutes"

If your tool expects X running, you can set $DISPLAY as part of the command:

! echo DISPLAY=:0.0 xeyes | at noon

or

! echo DISPLAY=:0.0 xmessage "Go home" | at 5:00pm

NB: on some systems, the at(1) processing gets launched by a cron job that runs every 5 minutes, so you might not have more fine-grained resolution down to the minute.

Show older
BSD Network

bsd.network is a *BSD-adjacent Mastodon Instance. We have a code of conduct.