#n Print line before and after changes.
/^\.Ah/{
p
s/"//g
s/^\.Ah //p
}
Note that the print flag is supplied to the substitute command. The
substitute command's print flag differs from the print command in that
it is conditional upon a successful substitution.
Here's a sample run of the above script:
$ sed -f sed.debug ch05
.Ah "Comment"
Comment
.Ah "Substitution"
Substitution
.Ah "Delete"
Delete
.Ah "Append, Insert and Change"
Append, Insert and Change
.Ah "List"
List
Each affected line is printed twice.
We'll see additional examples of the print command in the next
chapter. See also the multiline print command (P)
in the next chapter.
 |  |  |
5.7. Transform |  | 5.9. Print Line Number |