Regex fix was a bug; this undoes it
authorBen Ostrowsky <ben@esilibrary.com>
Wed, 16 Dec 2009 21:30:45 +0000 (21:30 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 16 Jul 2012 16:06:49 +0000 (12:06 -0400)
git-svn-id: svn://nox.esilibrary.com/migration-tools@651 eee7cc8d-164e-4af6-8e1b-092a69004917
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

unicorn/unicorn_to_tsv.pl

index 3af493f..7ba2d7a 100755 (executable)
@@ -21,7 +21,7 @@ while (<>) {
                $line = 0;
                $serial++;
                $section = ''; # just in case this didn't get reset in the previous record
-               # print STDERR "Processing record $serial.\n";
+               print STDERR "Processing record $serial.\n";
                next;
        }
 
@@ -36,7 +36,7 @@ while (<>) {
 
        # Is this line the beginning of a block of data (typically an address or a note)?
        if ( /^\.(.*?)_BEGIN.$/ ) {
-               # print STDERR "I think this might be the beginning of a beautiful " . $1 . ".\n";
+               print STDERR "I think this might be the beginning of a beautiful " . $1 . ".\n";
                $section = "$1.";
                next;
        }
@@ -46,14 +46,14 @@ while (<>) {
                if ("$1." ne $section) {
                        print STDERR "Error in record $serial, line $line (input line $.): got an end-of-$1 but I thought I was in a $section block!\n";
                }
-               # print STDERR "It's been fun, guys, but... this is the end of the " . $1 . ".\n";
+               print STDERR "It's been fun, guys, but... this is the end of the " . $1 . ".\n";
                $section = '';
                next;
        }
 
        # Looks like we've got some actual data!  Let's store it.
        # FIXME: For large batches of data, we may run out of memory and should store this on disk.
-       if ( /^\.([A-Z]*?).\s+(\|a)?(.*)$/ ) {
+       if ( /^\.(.*?).\s+(\|a)?(.*)$/ ) {
 
                # Build the name of this field (taking note of whether we're in a named section of data)
                $field = '';
@@ -68,7 +68,7 @@ while (<>) {
                # Now we can actually store this line of data!
                $records[$serial]{$field} = $3;         
 
-               # print STDERR "Data extracted: \$records[$serial]{'$field'} = '$3'\n";
+               print STDERR "Data extracted: \$records[$serial]{'$field'} = '$3'\n";
 
                next;
        }       
@@ -77,7 +77,7 @@ while (<>) {
        else {
                chomp($_);
                $records[$serial]{$field} .= ' ' . $_;
-               # print STDERR "Appended data to previous field. \$records[$serial]{'$field'} is now '" . $records[$serial]{$field} . "'.\n";
+               print STDERR "Appended data to previous field. \$records[$serial]{'$field'} is now '" . $records[$serial]{$field} . "'.\n";
        }
 
 }