insert-header.sed (1019B)
1 # Sed script that inserts the file called HEADER before the header entry. 2 # 3 # Copyright (C) 2001 Free Software Foundation, Inc. 4 # This file is free software; the Free Software Foundation 5 # gives unlimited permission to copy and/or distribute it, 6 # with or without modifications, as long as this notice is preserved. 7 # This file is offered as-is, without any warranty. 8 # 9 # Written by Bruno Haible <bruno@clisp.org>, 2001. 10 # 11 # At each occurrence of a line starting with "msgid ", we execute the following 12 # commands. At the first occurrence, insert the file. At the following 13 # occurrences, do nothing. The distinction between the first and the following 14 # occurrences is achieved by looking at the hold space. 15 /^msgid /{ 16 x 17 # Test if the hold space is empty. 18 s/m/m/ 19 ta 20 # Yes it was empty. First occurrence. Read the file. 21 r HEADER 22 # Output the file's contents by reading the next line. But don't lose the 23 # current line while doing this. 24 g 25 N 26 bb 27 :a 28 # The hold space was nonempty. Following occurrences. Do nothing. 29 x 30 :b 31 }