Chapter 5. The GNU sed stream editor

Table of Contents

1. Introduction
1.1. What is sed?
1.2. sed commands
2. Interactive editing
2.1. Printing lines containing a pattern
2.2. Deleting lines of input containing a pattern
2.3. Ranges of lines
2.4. Find and replace with sed
3. Non-interactive editing
3.1. Reading sed commands from a file
3.2. Writing output files
4. Summary
5. Exercises

Abstract

At the end of this chapter you will know about the following topics:

  • What is sed?

  • Interactive use of sed

  • Regular expressions and stream editing

  • Using sed commands in scripts

This is an introduction

These explanations are far from complete and certainly not meant to be used as the definite user manual for sed. This chapter is only included in order to show some more interesting topics in the next chapters, and because every power user should have a basic knowledge of things that can be done with this editor.

For detailed information, refer to the sed info and man pages.