#!/usr/bin/perl -w
+# Copyright 2009-2012, Equinox Software, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
# Converts a Unicorn users.data file to a tab-separated file.
# 2009-08-10 Ben Ostrowsky <ben@esilibrary.com>
}
$records[$u]{'l_' . $a . '_std_line1'} = $records[$u]{'USER_' . uc($a) . '.STREET'};
$records[$u]{'l_' . $a . '_std_line2'} = $records[$u]{'USER_' . uc($a) . '.LINE2'};
- if ((defined $records[$u]{'USER_' . uc($a) . '.CITY/STATE'}) && ($records[$u]{'USER_' . uc($a) . '.CITY/STATE'} =~ m/^(.*),(\s*)(.*)$/)) {
+ if ((defined $records[$u]{'USER_' . uc($a) . '.CITY/STATE'}) && ($records[$u]{'USER_' . uc($a) . '.CITY/STATE'} =~ m/^(.*),?(\s+)(.*)$/)) {
$records[$u]{'l_' . $a . '_std_city'} = $1;
$records[$u]{'l_' . $a . '_std_state'} = $3;
}
}
-
# Print the results
+print join("\t", @output_fields) . "\n";
+
for (my $u = 0; $u < @records; $u++) {
foreach $f (@output_fields) {
if (defined $records[$u]{$f}) {