1a32e9e42Smrg# Sed script that inserts the file called HEADER before the header entry.
2a32e9e42Smrg#
3a32e9e42Smrg# At each occurrence of a line starting with "msgid ", we execute the following
4a32e9e42Smrg# commands. At the first occurrence, insert the file. At the following
5a32e9e42Smrg# occurrences, do nothing. The distinction between the first and the following
6a32e9e42Smrg# occurrences is achieved by looking at the hold space.
7a32e9e42Smrg/^msgid /{
8a32e9e42Smrgx
9a32e9e42Smrg# Test if the hold space is empty.
10a32e9e42Smrgs/m/m/
11a32e9e42Smrgta
12a32e9e42Smrg# Yes it was empty. First occurrence. Read the file.
13a32e9e42Smrgr HEADER
14a32e9e42Smrg# Output the file's contents by reading the next line. But don't lose the
15a32e9e42Smrg# current line while doing this.
16a32e9e42Smrgg
17a32e9e42SmrgN
18a32e9e42Smrgbb
19a32e9e42Smrg:a
20a32e9e42Smrg# The hold space was nonempty. Following occurrences. Do nothing.
21a32e9e42Smrgx
22a32e9e42Smrg:b
23a32e9e42Smrg}
24