frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Sed, a powerfull mini-language from the 70s

https://julienlargetpiet.tech/articles/sed-a-powerfull-mini-language-from-the-70s.html
15•random__duck•1h ago

Comments

supriyo-biswas•1h ago
This would have been a good article if the author actually took the time to write out the article themselves, perhaps in their native language, rather than using a LLM to write it.
adelks•1h ago
Indeed.
surgical_fire•1h ago
Man, I don't even hate LLM for the sake of it, but this LLM language and formatting is really grating after a while.
TheChaplain•13m ago
This one feels more authentic.

https://www.grymoire.com/Unix/Sed.html

phplovesong•1h ago
For those of us using vim/neovim sed is something everyone had to learn, even if they did not realize it.

This is the true power of vim. Even now decades later the unix toolbelt holds up, and is still unmatched for productivity.

Vim is in the end just a small piece of the puzzle. You use small tools for your problem, mix and match.

Its kind of like functional programming. Compose and reduce.

aperrien•1h ago
Thanks for the blast from the past. SED led me to AWK, which led me to Perl, which lead me to Python. An interesting chain that brought me back to the interpreted languages like BASIC that I programmed in when I was a kid. Even though my formal training in college was Pascal and C.
0xfaded•1h ago
I learned sed back in the day to show off. I wish I'd invested that effort in learning perl oneliners instead. For whatever reason I picked up enough awk along the way, and now that's what I tend to use if I ever need something beyond a simple substitution.
evanjrowley•1h ago
For a while my home had a Raspberry Pi 2B running FreeBSD 10 acting as a router-on-a-stick. When I lost SSH connectivity to it, I would instead use GNU screen as with a serial cable. For whatever reason, I could never get "full screen" TUI apps like vi and nano to display properly. To edit files (like pf.conf for firewall rules), I had to use sed to edit lines of the file. It was an interesting learning experience and perhaps a glimpse of how things used to be with green screen terminals. Shortly thereafter I switched over to a Beaglebone Green with OpenBSD 5 and never needed that workaround again.
jasonpeacock•1h ago
Long ago, I bought the O'Reilly "Sed & Awk" book with plans to become a true unix guru.

Then I realized I already knew Perl (and Perl one-liners), so there it sat unused on the shelf.

stvltvs•17m ago
Mostly it's useful in my experience on systems without Perl installed, but that doesn't often come up in my world.
piekvorst•48m ago
I prefer sam [1]. Unlike sed, it's not Turing complete, but it is far more elegant to my taste - consider this example from the article:

    :loop N; s/\n[[:space:]]\+/ /g; t loop; p
In sam, the equivalent is:

    x/(.+\n)*/ x/\n */ c/ /
It reads like this: loop over paragraphs of non-empty lines, loop over newline followed by spaces, replace with a single space. It's surprisingly close to SQL in its eloquence.

Another example:

    N; h; s/\n/->/g ;p; g; D
In sam, a rough equivalent would be

    {
        1,$-2 x/./ {
            a/->/
            /./ t .
        }
        $-1 d
    }
Again, it's readable from top to bottom: from the first line to the second from the end, loop over each symbol, put "->" after it and copy the next symbol next to it; delete the last line.

Let's see how far we can get. Another example:

    N; h; s/\n/->/g; p; G; D
In sam, a rough equivalent would be:

    {
        d
        1,$-2 x/./ {
            1,/./ x/.|\n/ {
                g/./ t $
                g/\n/ $ c/->/
            }
            $ c/\n/
        }
    }
It reads like this: delete the whole thing; from the first line to the second from the end, loop over each character; on each iteration, from the first line to the next character, run an inner loop over each character or newline; if it's a character, put it at the end; otherwise, put "->" at the end; once the inner loop is done, put a newline at the end.

The final example from the post is too long to have it here (15 lines). Here's just the sam equivalent for it:

    x/(.+\n)+|\n+/ {
        g/./ x/\n/ c/ /
        v/./ c/\n/
    }
It reads like this: loop over paragraphs of non-empty lines or sequences of newline characters; if it has any symbol (that is, it's a paragraph), replace each newline symbol with a space; if it doesn't have a symbol (that is, it's a sequence of newline symbols), replace it with a single newline.

What I have learned from this is that the right concept, however limited (and sam is far from being universal), is a better tool than a pure state machine.

(My examples may not be the exact same algorithms, since I do not understand (or need) sed concepts, but they do produce the same output.)

[1]: https://9p.io/sys/doc/sam/sam.html

What Does a Hologram Trademark Signify When the Hologram Isn't There?

https://blog.ericgoldman.org/archives/2026/03/what-does-a-hologram-trademark-signify-when-the-hol...
1•hn_acker•56s ago•1 comments

Microsoft's "Fix" for Windows 11: Flowers After the Beating

https://www.sambent.com/microsofts-plan-to-fix-windows-11-is-gaslighting/
1•speckx•1m ago•0 comments

Migrating Snapchat's AB Pipelines to GPU-Accelerated Spark

https://eng.snap.com/snap-nvidia-gcp
1•Kaedon•1m ago•0 comments

We Built an AI Memory System That Learns

https://getcoherence.io/blog/how-we-built-an-ai-memory-system-that-actually-learns-55bcdf82
1•keithfawcett•2m ago•0 comments

Gen 13: how we built our most powerful server yet

https://blog.cloudflare.com/gen13-config/
1•NicoJuicy•2m ago•0 comments

ChatGPT and the Meaning of Life: Guest Post by Harvey Lederman

https://scottaaronson.blog/?p=9030
1•gwintrob•5m ago•0 comments

Free Multilingual Dictionaries

https://yap.town/d/
1•ChadNauseam•6m ago•1 comments

Ancient machine gun was used by Romans to attack Pompeii

https://www.telegraph.co.uk/world-news/2026/03/22/ancient-machine-gun-was-used-by-romans-to-attac...
1•Stratoscope•6m ago•0 comments

A Ramsey-Style Problem on Hypergraphs

https://epoch.ai/frontiermath/open-problems/ramsey-hypergraphs
1•yusufozkan•7m ago•0 comments

Canvas Unrolls AI Teaching Agent

https://www.insidehighered.com/news/tech-innovation/artificial-intelligence/2026/03/23/canvas-unr...
1•speckx•7m ago•0 comments

The Magnet Suspension Skateboard

https://www.youtube.com/watch?v=yzXZ7cZXifo
1•mhb•8m ago•0 comments

macOS app to copy LaTeX renders/text/QR codes from screenshot automatically

https://github.com/Blobosle/screen-copy/
1•blobosle•9m ago•0 comments

Show HN: Zoom Auto-Joiner

https://github.com/PiotrMackowski/auto-joiner
1•ptrmc•12m ago•1 comments

Neo Store: The modern and feature-rich F-Droid client for everyone

https://github.com/NeoApplications/Neo-Store
1•pretext•13m ago•0 comments

Simply looking up inspires scientific exploration

https://bigthink.com/starts-with-a-bang/why-we-look-up/
1•Brajeshwar•15m ago•0 comments

XMind MCP Server – Incremental mind map editing for LLMs

https://github.com/sc0tfree/xmind-mcp
1•sc0tfree•17m ago•1 comments

Intel Core Ultra 200S Plus Content Creation Review

https://www.pugetsystems.com/labs/articles/intel-core-ultra-200s-plus-content-creation-review/
1•zdw•18m ago•0 comments

Philips to drop Google TV for European-based Titan OS

https://9to5google.com/2026/03/23/google-tv-just-lost-a-big-tv-brand-to-web-app-based-titan-os/
4•pentagrama•18m ago•3 comments

Unix philosophy is dead Long live something else?

https://sdomi.pl/weblog/27-manifesto-of-a-burnt-out-hacker/
1•caminanteblanco•19m ago•0 comments

A single Keycloak commit broke our p99 latency

https://old.reddit.com/r/KeyCloak/comments/1rto63s/how_a_single_keycloak_commit_broke_our_p99/
1•mooreds•21m ago•0 comments

10MB Go Alternative to OpenClaw (Full Clawhub Skills)

https://github.com/General-Specialist/capabot
2•gen_specialist•22m ago•1 comments

Ten Months with Copilot Coding Agent in Dotnet/Runtime

https://devblogs.microsoft.com/dotnet/ten-months-with-cca-in-dotnet-runtime/
2•pestkranker•23m ago•0 comments

Startup left production AWS keys public for 5 months; their VDP was silent

https://benzimmermann.dev/blog/pump-vdp-silence
2•Terretta•24m ago•2 comments

The Picture They Paint of You – AI SREs

https://ferd.ca/the-picture-they-paint-of-you.html
1•sylvainkalache•24m ago•0 comments

"Will AI force code to evolve or make it extinct?"

https://thenewstack.io/ai-programming-languages-future/
1•MilnerRoute•25m ago•1 comments

Value creation in the metaverse (2022) [pdf]

https://www.mckinsey.com/~/media/mckinsey/business%20functions/marketing%20and%20sales/our%20insi...
1•toomuchtodo•25m ago•1 comments

Pancakes, Hot Takes, and Social Media's Flatness

https://tedium.co/2026/03/23/social-media-flat-discussion/
2•freediver•26m ago•0 comments

The OpenBSD init system and boot process

https://overeducated-redneck.net/blurgh/openbsd-init-system.html#content
1•speckx•27m ago•0 comments

Fastest general-purpose sorting library for JavaScript – 95.2% win rate vs. NPM

https://github.com/AyoobAI/ayoob-sort
1•Husain-Ayoob-I•27m ago•4 comments

Biosynthesis of Cinchona Alkaloids

https://www.nature.com/articles/s41586-026-10227-x
1•bookofjoe•29m ago•0 comments