Linux Know-How provides a collection of introductory texts on often needed Linux skills. |
Home Bash Guide for Beginners The GNU stream editor SED Commands | |||||||||||||||||||||||||||||
See also: Regular expressions, Grep and regular expressions, Interactive editing, Non-interactive editing, Getting started with gawk, Gawk variables | |||||||||||||||||||||||||||||
Search the VIAS Library | Index | |||||||||||||||||||||||||||||
SED CommandsA Stream EDitor is used to perform basic transformations on text read from a file or a pipe. The result is sent to standard output. The syntax for the sed command has no output file specification, but results can be saved to a file using output redirection. The editor does not modify the original input. What distinguishes sed from other editors, such as vi and ed, is its ability to filter text that it gets from a pipeline feed. You do not need to interact with the editor while it is running; that is why sed is sometimes called a batch editor. This feature allows use of editing commands in scripts, greatly easing repetitive editing tasks. When facing replacement of text in a large number of files, sed is a great help. sed commandsThe sed program can perform text pattern substitutions and deletions using regular expressions, like the ones used with the grep command; see Section 4.2. The editing commands are similar to the ones used in the vi editor: Table 5-1. Sed editing commands
Apart from editing commands, you can give options to sed. An overview is in the table below: Table 5-2. Sed options
The sed info pages contain more information; we only list the most frequently used commands and options here.
|
|||||||||||||||||||||||||||||
Home Bash Guide for Beginners The GNU stream editor SED Commands |