Re: Sort with MARC::Record (correction)

2006-01-25 Thread Saiful Amin
Hi Leif, It has been almost a year since you posted this piece of marvellous code. I was looking for something like this and had just to copy and paste with some changes and it worked to perfection! Wanted to thank you for this. Best regards, Saiful Here's my code: -

RE: DBM files was RE: Sort with MARC::Record

2005-02-01 Thread Christopher Morgan
Bryan, Too bad about the MacPerl restriction. I don't need the DBI module to use DB hashes. DB hash capability came with my Perl distribution, and it might come with MacPerl, too -- I don't know. (I'm running Perl under RedHat Linux). I've had no trouble creating DB hashes whose keys are lccn nu

DBM files was RE: Sort with MARC::Record

2005-02-01 Thread Bryan Baldus
On Tuesday, February 01, 2005 8:37 AM, Christopher Morgan wrote: >I've had very good luck using DBM files to store, sort, >and retrieve MARC records. I've only looked at DBM a little bit, but from what I saw, the versions available to me (in MacPerl, and possibly in Windows) would not allow stor

RE: Sort with MARC::Record

2005-02-01 Thread Christopher Morgan
>It should work ok on small files of MARC records, but >depending on your system's memory, may die a horrible >death on large record sets. I've had very good luck using DBM files to store, sort, and retrieve MARC records. This effectively eliminates the RAM issue, since DBM files retrieve on

Re: Sort with MARC::Record (correction)

2005-02-01 Thread Leif Andersson
I am sorry, my earlier posting contained a little error. The last print statement should read print $records[$rec->[0]]->as_usmarc(); Jackie also pointed out that his 001 is alphanumeric. So he changed the comparision operator from "<=>" (numeric) to "cmp" The script should have looked

Re: Sort with MARC::Record

2005-02-01 Thread Jackie Shieh
Thank y'all, Bryan Baldus & Leif Andersson! No worries... all records have been checked with the presence of an 001. --Jackie On Mon, 31 Jan 2005, Leif Andersson wrote: > > This is one way to do it: > > #!/usr/local/bin/perl -w > use strict; > use MARC::Batch; > > # sort marc records on field

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

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 sh