home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: D Chapter 10
The Sed Editor
Next: Reference: G
 

g

[

address1

][

,



address2

]

g

Paste the contents of the hold space (see h or H command) back into the pattern space, wiping out the previous contents of the pattern space. The example shows a simple way to copy lines.

Example

This script collects all lines containing the word Item: and copies them to a place marker later in the file. The place marker is overwritten.

/Item:/H
/<Replace this line with the item list>/g


Previous: Reference: D UNIX in a Nutshell: System V Edition Next: Reference: G
Reference: D Book Index Reference: G

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System