Four Types of sed Scripts
In this section, we are going to look at four types of scripts, each one illustrating a typical sed application.
Multiple Edits to the Same File
The first type of sed script demonstrates making a series of edits in a file. The example we use is a script that converts a file created by a word processing program into a file coded for troff.
One of the authors once did a writing project for a computer company, here referred to as BigOne Computer. The document had to include a product bulletin for “Horsefeathers Software.” The company promised that the product bulletin was online and that they would send it. Unfortunately, when the file arrived, it contained the formatted output for a line printer, the only way they could provide it. A portion of that file (saved for testing in a file named horsefeathers) follows.
HORSEFEATHERS SOFTWARE PRODUCT BULLETIN DESCRIPTION + ___________ BigOne Computer offers three software packages from the suite of Horsefeathers software products -- Horsefeathers Business BASIC, BASIC Librarian, and LIDO. These software products can fill your requirements for powerful, sophisticated, general-purpose business software providing you with a base for software customization or development. Horsefeathers BASIC is BASIC optimized for use on the BigOne machine with UNIX or MS-DOS operating systems. BASIC Librarian is a full screen program editor, which also provides the ability
Note that the text has been justified with spaces added between ...