
766
|
Chapter 10: The sed Editor
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
r
[address]r file
[address1[,address2]]r file {G}
Read contents of file and append to the output after the contents of
the pattern space. There must be exactly one space between the r
and the filename. The GNU version accepts two addresses.
Example
/The list of items follows:/r item_file
R
[address1[,address2]]R file {G}
Read one line of file and append to the output after the contents of
the pattern space. Successive R commands read successive lines
from file.
s
[address1[,address2]]s/pattern/replacement/[flags]
Substitute replacement for pattern on each addressed line. If pattern
addresses are used, the pattern // represents the last pattern address
specified. Any delimiter may be used. Use \ within pattern or
replacement to escape the delimiter. The following flags can be
specified (those marked with a † are specific to GNU sed):
n Replace nth instance of pattern on each addressed line. n is
any number in the range 1 to 512, and the default is 1.
e† If the substitution was made, execute the contents of the
pattern space as a shell command and replaces the pattern
space with the results.
g Replace all instances of pattern on each addressed line, not
just the first instance.
i or I†
Do a case-insensitive regular expression match.
m or M†
Allow ^ and $ to match around ...