We like to convert db files between liux platform and solaris platform. for example, on solaris, we read the db file and print it to a text file. Then convert the text file to db file on Linux platform.

Read db file and print it to a text file, it is ok. But how to convert the text file to a db file?

The script to read the db file and print it to a text file:


#!/usr/bin/perl


use GDBM_File;

$filename="hwang_userdb";

die "no file: $@" unless $ARGV[0];

dbmopen( %db, $ARGV[0], undef) or die "could not open database file $ARGV[0]: $! $@";

open(FILE,">$filename") ||die "couldn't open file $filename";

foreach $key (sort keys(%db))
{
 print  FILE "$key=>$db{$key}\n";
}

dbmclose %db;


But how to convert the text file to a db file?


Thanks in advance!

Hong




_______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to