diff options
Diffstat (limited to '')
-rwxr-xr-x | make_servers_charset.pl | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/make_servers_charset.pl b/make_servers_charset.pl new file mode 100755 index 0000000..2f83a09 --- /dev/null +++ b/make_servers_charset.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +while (<>) { + chomp; + s/#.*$//; + s/^\s+//; s/\s+$//; + next if /^$/; + + die "format error: $_" if not + (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|; + } +} + |