Conceptual Overview
Command-Line Syntax
Syntax of sed Commands
Group Summary of sed Commands
Alphabetical Summary of sed Commands
This chapter presents the following topics:
Conceptual overview of sed
Command-line syntax
Syntax of sed commands
Group summary of sed commands
Alphabetical summary of sed commands
For more information, see the O'Reilly book sed & awk, 2d ed., by Dale Dougherty and Arnold Robbins.
sed is a noninteractive, or stream-oriented, editor. It interprets a script and performs the actions in the script. sed is stream-oriented, because, as with many Unix programs, input flows through the program and is directed to standard output. For example, sort is stream-oriented; vi is not. sed's input typically comes from a file but can be directed from the keyboard. Output goes to the screen by default but can be captured in a file instead.
Typical uses of sed include:
Editing one or more files automatically
Simplifying repetitive edits to multiple files
Writing conversion programs
sed operates as follows:
Each line of input is copied into a pattern space.
All editing commands in a sed script are applied in order to each line of input.
Editing commands are applied to all lines (globally) unless line addressing restricts the lines affected.
If a command changes the input, subsequent commands are applied to the changed line, not to the original input line.
The original input file is unchanged, because the editing commands modify a copy of the original input line. The copy is sent to standard output (but can be redirected to a file).
Copyright © 2001 O'Reilly & Associates. All rights reserved.
This HTML Help has been published using the chm2web software. |