#!/usr/bin/perl

while ($_ = &get_line()) {
        next if /^\$.*/;

	s/(^\d+) //;
	$lline = $1;
	$line++;
	print;
}
if ($line != $lline) {
	print STDERR "Converted $line lines, but last message no. was $lline\n";
	exit(1);
}
exit(0);

# get a line, combining continuation lines
sub get_line {
        $nextline = "";
        line: while ($nextline .= <>) {
                if ($nextline =~ /(.*)\\\n/) {
                        $nextline = $1;
                } else {
                        last line;
                }
        }
        $nextline;
}
