Sort with MARC::Record

2005-01-31 Thread Jackie Shieh
Has anyone sorted a file of hundreds of records by 001? I have a file of 518 records unsorted and a file of sorted ids from 001 (406). I would like to sort my marc 518 records first before extracting the 406 records based on the 2nd file from the set of 518 records. I'd appreciate any

RE: Sort with MARC::Record

2005-01-31 Thread Bryan Baldus
Has anyone sorted a file of hundreds of records by 001? I haven't done sorting yet, but you may want to see if my MARC::BBMARC's [1], MARC::BBMARC::updated_record_hash() sub may be of use. It reads a file of MARC records and stores them in a hash with the 001 as key, the raw MARC as value. It

Re: Sort with MARC::Record

2005-01-31 Thread Leif Andersson
This is one way to do it: #!/usr/local/bin/perl -w use strict; use MARC::Batch; # sort marc records on field 001 # usage: sort_marc.pl infil.mrc utfil.mrc my $batch = new MARC::Batch( 'USMARC', $ARGV[0] ); my @records = (); my @f001= (); my $idx = 0; while ( my $MARC = $batch-next