In the world of “Word” and ribbons, people solve text problems with a mouse and a prayer. But for those of us working Under the Anvil, we know that text isn’t something to be highlighted and dragged—it’s a stream to be directed.
Enter sed (the Stream Editor). It is the surgeon’s knife of the terminal: precise, cold, and incredibly fast.
Why sed?
As a Textsmith, I often need to perform repetitive tasks across dozens of files. If I decide to change a category name in my Hugo blog from “OldTech” to “The Lab,” I don’t open ten files. I let sed do the heavy lifting.
3 Essential Strikes for Your Toolkit
Here are the one-liners I keep in my immediate reach.
1. The Global Swap
To replace every instance of “Vim” with “Neovim” in a single file:
sed -i 's/Vim/Neovim/g' post.md
2. The Line Delete
Sometimes you have a standard footer or an accidental line you need to vanish. To delete line 10 of a file:
sed -i '10d' draft.md
3. The Front-Matter Surgeon
Need to update the date on a post to today?
sed -i 's/^date = .*/date = 2026-02-14/' content/blog/new-post.md
The Craftsmanship of the Command Line
Using sed is a reminder that complexity is often an illusion. Most of the work we do involves patterns. Once you recognize the pattern, you don’t need a GUI; you just need a well-crafted expression.
In my next entry in The Lab, we’ll look at how awk takes this a step further by treating our text as a database. Until then, keep your buffers clean and your expressions regular.
Forged in the terminal. Refined under the anvil.