Alex,
I was reading an earlier message about converting exisiting db to dbm format. Any easy way of editing this script to it increments the id number, at present it gives ID 1 splits up the fields ok but doesn't increment i.e the whole db is one record.
Any ideas anyone?
#!/usr/bin/perl -w
use strict;
my $dir ='test';
my $out ='output.db';
opendir (DIR, "test") or die $!;
my @files =grep $_ !~/^\.\.?$/, readdir (DIR);
closedir (DIR);
open (DB, ">$out") or die $!;
my $id =0;
foreach (@files) {
my @rec = ();
open (FILE,"$dir/$_")or die $!;
while (<FILE> ) {
chomp;
s/<[^>]+>//g;
push (@rec, $_);
}
close FILE;
print DB join ("|",$id++,@rec),"\n";
}
close DB;
I have several exisiting dbs to convert over 3,ooo records and it is gonna take me years.
Scott
I was reading an earlier message about converting exisiting db to dbm format. Any easy way of editing this script to it increments the id number, at present it gives ID 1 splits up the fields ok but doesn't increment i.e the whole db is one record.
Any ideas anyone?
#!/usr/bin/perl -w
use strict;
my $dir ='test';
my $out ='output.db';
opendir (DIR, "test") or die $!;
my @files =grep $_ !~/^\.\.?$/, readdir (DIR);
closedir (DIR);
open (DB, ">$out") or die $!;
my $id =0;
foreach (@files) {
my @rec = ();
open (FILE,"$dir/$_")or die $!;
while (<FILE> ) {
chomp;
s/<[^>]+>//g;
push (@rec, $_);
}
close FILE;
print DB join ("|",$id++,@rec),"\n";
}
close DB;
I have several exisiting dbs to convert over 3,ooo records and it is gonna take me years.
Scott

