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:
-
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
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
>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
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
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
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
>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