Sed Tutorial, Examples, Scripts and Tips

Introduction to Sed

Basic Sed Concepts and Commands.

Often Used Sed Commands.

Basic Regex.

s command.

Understanding Sed Scripts.

Other Sed Learning Resources

The idea is to have a lot of repetition on the basic ideas on different types of problems. We believe it doesn’t help much to give one example only on how to use a given feature. Knowing that the construct s/foo/bar/ is used to search and replace text is easy to remember, but that doesn’t mean one has the necessary experience to use it to solve different problems.

For instance, for a really beginner programmer, if he or she knows they can do 2 + 3 = 5 and that they can do a = 2; b = 3; and then proceed to a + b = 5 doesn’t mean they’ll realise that they can also do a + 3 and 2 + b or even a + -5, for instance.

I emphasize: lots of examples that keep reusing the same concepts to solve different problems really help one gain insight on how to use them for even more problems later much more than just memorizing ``Ah, s is substitute’’.

In the book Mastering Regular Expressions the author says that a lot of stuff in the book are not about regex itself, but are about using regex. That is a really nice idea to cling to.

I wish some IRC channels were more open to related subjects instead of being proud to shout “off-topic” to everything they possibly can.

Other Sed Learning Resources