Sed one-liners

by John on September 27, 2011

A few weeks ago I reviewed Peteris Krumins’ book Awk One-Liners Explained. This post looks at his sequel, Sed One-Liners Explained.

The format of both books is the same: one-line scripts followed by detailed commentary. However, the sed book takes more effort to read because the content is more subtle. The awk book covers the most basic features of awk, but the sed book goes into the more advanced features of sed.

Sed One-Liners Explained provides clear explanations of features I found hard to understand from reading the sed documentation. If you want to learn sed in depth, this is a great book. But you may not want to learn sed in depth; the oldest and simplest parts of sed offer the greatest return on time invested. Since the book is organized by task — line numbering, selective printing, etc — rather than by language feature, the advanced and basic features are mingled.

On the other hand, there are two appendicesĀ  organized by language feature. Depending on your learning style, you may want to read the appendices first or jump into the examples and refer to the appendices only as needed.

For a sample of the book, see the table of contents, preface, and first chapter here.

Related links:

Learn one sed command
Daily tips on sed and awk

{ 1 trackback }

Perl One-Liners Explained — The Endeavour
02.04.12 at 12:27

{ 5 comments… read them below or add one }

1

Rick Wicklin 09.27.11 at 13:09

By coincidence, I also blogged about one-liners today. Summary: I don’t usually like them. http://community.amstat.org/AMSTAT/Blogs/BlogViewer/?BlogKey=9b18af5f-e28b-4cc1-a5bc-55d85c3af1e2

And since you didn’t link to your own one-liner post, I’ll do it for you:
http://www.johndcook.com/blog/2011/03/15/a-support-one-liner/

2

Super Cholo 09.27.11 at 21:09

This post is a good example of why this is one of the best blogs on the internet (yes, including my own :) It includes actual thinking, in this case a thought out review, understanding that the reader may not be the same in style / taste as the writer.

I should add that due to it’s content, it is probably one of the less read blogs on the internet, but really, who cares? On that road lies a race to the bottom.

3

John 09.27.11 at 21:19

Thanks, Super Cholo. This blog has a good number of readers, but it might have more if I wrote about cats, online marketing, and weight loss secrets.

4

Peteris Krumins 09.27.11 at 21:37

Thanks for posting the review!

5

Krzysztof Sakrejda-Leavitt 09.28.11 at 21:39

I was in love with Sed one-liners, until I found out that you could put multiple lines of sed in one file. I haven’t looked back since!

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

It’s the new black, you’ll love it.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>