blob: 8517b75caac760f3d790397b4b7668ef6c9d3ef2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/usr/bin/perl
use warnings;
use strict;
while (<>) {
chomp;
s/#.*$//;
s/^\s+//; s/\s+$//;
next if /^$/;
die "format error: $_" unless
(my ($a, $b, $c) = /^([a-z0-9.-]+)\s+([a-z0-9-]+)(?:\s+(.+))?$/);
if ($c) {
print qq( { "$a",\t"$b",\t"$c" },\n);
} else {
print qq( { "$a",\t"$b",\tNULL },\n);
}
}
|