1#!/usr/local/bin/perl
2use warnings;
3#
4# Script to convert a UI-View log file to an Xastir log file.
5#
6# Copyright (C) 2000-2019 The Xastir Group
7#
8# This program is free software; you can redistribute it and/or
9# modify it under the terms of the GNU General Public License
10# as published by the Free Software Foundation; either version 2
11# of the License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21# 02111-1307, USA.
22#
23# NOTE:  Run it against an input file and tell it where to put the
24# output:
25#
26#  ./UIView2XastirLog.pl  <input_file.log  >output_file.log
27#
28# No timestamp info is converted or saved by this script.
29
30
31while (<>) {
32
33    chomp;
34
35    if (m/START UTC/) {
36        # Skip it
37        next;
38    }
39
40    # If line starts with date field, chop off the date, time1,
41    # time2 fields.
42    #
43    if (m/^\d\d\d\d\-\d\d\-\d\d\s.*/) {
44        s/^\d\d\d\d\-\d\d\-\d\d\s+\d\d\:\d\d:\d\d\s+\d\d\:\d\d:\d\dR//;
45        # Get rid of " <UI Len=19>"
46        s/\s\<UI\sLen\=\d+\>:\r/:/;
47
48        # Save current line
49        $temp = $_;
50
51        # Read next line
52        $_ = <>;
53        chomp;
54
55        # Concatenate the two
56        $temp = $temp . $_ . "\n";
57
58        print $temp;
59    }
60}
61
62
63