1BEGIN {
2	if ((in1 == "") || (in2 == "") || (out == "")) {
3		print "Error: in1, in2 and out shall be defined. Exiting."
4		exit 1
5	}
6	# Make dates directly accessible
7	FS=":"
8
9	# Copy the first file lines up to the first entry
10	# (The reason why the UPDATING file exists).
11	x = getline < in1
12	while (( $0 !~ /^[0-9]+:$/) && (x == 1)) {
13		print $0 > out
14		x = getline < in1
15	}
16	trigger_date = $1
17
18	# Read the second file up to the first entry.
19	y = getline < in2
20	while (( $0 !~ /^[0-9]+:$/) && ( y == 1 ))  {
21		y = getline < in2
22	}
23	date = $1
24
25	# While we are not at EOF of both files, copy entries, from the newest
26	# to the oldest.
27	while ((x != 0) || (y != 0)) {
28		if (date > trigger_date) {
29			print date ":" > out
30			y = getline < in2
31			while (( $0 !~ /^[0-9]+:$/) && (y == 1)) {
32				print $0 > out
33				y = getline < in2
34			}
35			if (y == 1) {
36				date = $1
37			} else {
38				date = 0
39			}
40		} else {
41			print trigger_date ":" > out
42			x = getline < in1
43			while (( $0 !~ /^[0-9]+:$/) && (x == 1)) {
44				print $0 > out
45				x = getline < in1
46			}
47			if (x == 1) {
48				trigger_date = $1
49			} else {
50				trigger_date = 0
51			}
52		}
53	}
54
55}
56