Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at

hpr1976 :: Introduction to sed - part 1

What sed is and how to use it in a simple way

<< First, < Previous, , Latest >>

Thumbnail of Dave Morriss
Hosted by Dave Morriss on 2016-02-29 is flagged as Explicit and is released under a CC-BY-SA license.
sed, stream editor, option, regular expression, substitution. 7.
The show is available on the Internet Archive at:

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:44:28

Learning sed.

Episodes about using sed, the Stream Editor. It's a non-interactive editor which you can use to make simple changes to data, which is how many people use it. However, sed also has a lot of hidden power, especially in the GNU version.

Introduction to sed - part 1

sed is an editor which expects to read a stream of text, apply some action to the text and send it to another stream. It filters and transforms the text along the way according to instructions provided to it. These instructions are referred to as a sed script.

The name "sed" comes from Stream Editor, and sed was developed from 1973 to 1974 as a Unix utility by Lee E. McMahon of Bell Labs. GNU sed added several new features including better documentation, though most of it is only available on the command line through the info command. The full manual is of course available on the web.

To read the rest of the notes for this episode follow this link:


Subscribe to the comments RSS feed.

Comment #1 posted on 2016-03-18 08:31:19 by Gan Ainm

Another great sed resource

The book "Unix Text Processing" by Dale Dougherty and Tim O’Reilly (INTERNET "UTP Revi val" RELEASE — 2004 available at features a very illuminating description of stream editing and sed on pp. 288.

Comment #2 posted on 2016-03-21 22:05:08 by Dave Morriss

Thanks for this

I find the book fascinating, never having done more than dabble with nroff, troff and the like. It seems a touch dated, but interesting nonetheless. I'm not sure I'd recommend it for a sed beginner though.

I don't have a book recommendation to offer in return, having taught myself to use sed from manual pages and so forth. I started using sed on a DEC VAXCluster running VMS in the late 1980's. It had been ported to VMS from Unix and made my life much simpler, since VMS wasn't that good at doing this sort of editing.

Comment #3 posted on 2016-05-26 14:07:50 by Frank

I put off listening to this until I had the time and peace to concentrate and follow along in the shownotes.

All I can say is that regex still makes my brain hurt (but, since I've been fine-tuning my procmailrc file, I've got something to practice on).

I'm going to listen again and then do the rest of the series, slowly and deliberately.

Thanks. If the brain pain goes away, I'll let you know.

Comment #4 posted on 2016-05-26 21:38:30 by Dave Morriss

Good luck with regex

Hi Frank,

Regular expressions are a language in their own right. It's not a trivial concept to get your head around. However, learning how to use them is very rewarding because they are everywhere.

I used to use procmail for my mail back in the days when the university I worked at first connected to the internet and had access to TCP/IP and SMTP mail. (Prior to that we'd used DECMail and the UK "Coloured Book" networking protocols). I found the regular expressions in procmailrc challenging, but gradually got the hang of them.

I just posted the last episode of this series, number 5, today. I hope you make your way through them all and find them useful.

Comment #5 posted on 2016-06-01 22:42:19 by Frank

Part of my issue with regex is, of course, that I don't have much need to use it, so learning it is more an intellectual pursuit. It's not like I was sysadmin, for example, except of my own little home network.

That's why editing my procmailrc helps--it gives me a need to learn it.

If I ever understand regex, I shall proudly claim the title of "Linux Geek."

Comment #6 posted on 2016-06-03 21:15:11 by Frank

LO and SED

I stumbled over this at Linux Questions. It somehow seems germane:

Comment #7 posted on 2016-06-05 17:05:20 by Dave Morriss

Regex in Libre Office

As a long-term user of Libre Office, Open office before that and Star Office even before that, I love this feature and have used a lot!

My boss used to give me grief about not using Microsoft Word and adhering to the "Corporate Standards", but with a Unix box and later a Linux box on my desk I was *far* more productive the way I was :-)

In my experience the earlier versions of Word were not good, though regular expression capability did appear at some point. Microsoft's version of regex is of course different from the more standard versions found under Unix & Linux. Libre Office is much more conformant with the various standards I believe.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Anti Spam Question: What does the letter P in HPR stand for?
Are you a spammer?
What is the HOST_ID for the host of this show?
What does HPR mean to you?