Sed – An Introduction and Tutorial

Sed is the ultimate stream editor. If that sounds strange, picture a stream flowing through a pipe. Okay, you can't see a stream if it's inside a pipe. That's what I get for attempting a flowing analogy. You want literature, read James Joyce.

Anyhow, sed is a marvelous utility. Unfortunately, most people never learn its real power. The language is very simple, but the documentation is terrible. The Solaris on-line manual pages for sed are five pages long, and two of those pages describe the 34 different errors you can get. A program that spends as much space documenting the errors than it does documenting the language has a serious learning curve.

Do not fret! It is not your fault you don't understand sed. I will cover sed completely. But I will describe the features in the order that I learned them. I didn't learn everything at once. You don't need to either.

Sed – An Introduction and Tutorial.

Tags:

  1. I spotted about a dozen small grammar errors on your otherwise excellent sed tutorial:

    This chapter, like all of the rest, start (should be: starts)

    as much space documenting the errors than it does (should be: as it does)

    few fine points that an future sed expert (should be: a future sed expert)

    There’s only 63 more (should be: There are only 63 more)

    some characters, like parenthesis (should be: parentheses)

    this matches zero of more numbers (should be: zero or more numbers)

    expand the the regular (should be: expand the regular)

    leave the first world alone alone (should be: leave the first word alone)

    I wrote thise. (should be: I wrote this.)

    This could not done (should be: This could not be done)

    can be proceeded by (should be: can be preceded by)

    must wait until next section (should have a closing parenthesis)

    it has it’s own (should be: it has its own)

    Thank you for taking the time to help people become more proficient.

    Kind regards,
    Erik

  2. Not my document. Just a link to it. Might want to contact the folks at http://www.grymoire.com/

    Thanks for pointing it out, though.

  3. Unfortunately, sed on MacOSX does not support many of the sed functionality that comes on Unix/Linux.

  4. A more appropriate statement might be “the POSIX-specification ‘sed’ on Mac OS X has fewer features than the Gnu version of sed found on many Linux systems”.

    So install a Gnu version of sed (MacPorts, Fink, roll your own)
    8)