
768
|
Chapter 10: The sed Editor
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
T
[address1[,address2]]T [label] {G}
Like t, but only branches to label if there not any successful substi-
tutions. (see b, t, and
:). If label is not specified, control branches
to the bottom of the script.
v
[address1[,address2]]v [version] {G}
This command doesn’t do anything. You use it to require GNU sed
for your script. This works, because non-GNU versions of sed
don’t implement the command at all, and will therefore fail. If you
supply a specific version, GNU sed fails if the required version is
newer than the one executing the script.
w
[address1[,address2]]w file
Append contents of pattern space to file. This action occurs when
the command is encountered rather than when the pattern space is
output. Exactly one space must separate the w and the filename.
This command will create the file if it does not exist; if the file
exists, its contents will be overwritten each time the script is
executed. Multiple write commands that direct output to the same
file append to the end of the file.
GNU sed allows you to use the special filenames /dev/stdout and
/dev/stderr to write to standard output or standard error,
respectively.
Example
# Store HTML tables in a file
/<table/,/<\/table>/w tables.html
W
[address1[,address2]]W file
Like w, but only writes the contents of ...