Article View: pl.comp.lang.perl
Article #735Re: dbase IV files to comma delimited files
From: Marcus Blaha
Date: Mon, 01 Dec 1997 09:45
Date: Mon, 01 Dec 1997 09:45
57 lines
2238 bytes
2238 bytes
Akira wrote:
>
> Does anyone have a script that will take a dbase IV file and convert it to a
> comma delimited file using Perl 5??
>
> Any comments or suggestions would be welcomed.
>
> Thanx in advance
>
> Akira
Dear Akira,
try xbase.pm 1.0.7 which is available on the CPAN sites.
It reads dBase files and you get the contents of a record as a field.
This can be printed using the join function:
rough Example:
####################
push (@INC,'C:\\midosa'); #adjust it to your environment
require Xbase;
$dbf_name = '6.dbf';
$database = new Xbase;
$database->open_dbf($dbf_name);
print $database->dbf_type; # debug output
$database->dbf_stat; # debug output
$database->go_top;
while (1){
@fields = $database->get_record;
print "@fields\n"; # unformatted test output
$database->go_next;
if ($database->eof) {
last;
}
}
####################
Greetings from Bonn
Marcus
--
#################################################################
# Marcus Blaha startext Unternehmensberatung GmbH
# Kennedyallee 2 / 53175 Bonn
# Tel.: +49.228.95996-16 Fax.: +49.228.95996-66
# Compuserve 101317,3140 eMail mbl@startext.de
# WWW http://www.startext.de
#################################################################
Technical Details
Message-ID:
<34828752.7681@startext.de>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.icm.edu.pl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!news-out1.du.gtn.com!news-in2.du.gtn.com!news-in1.ne.gtn.com!news.xenologics.com!newsReferences:
<65s8vd$r1d@bgtnsc03.worldnet.att.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.icm.edu.pl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!news-out1.du.gtn.com!news-in2.du.gtn.com!news-in1.ne.gtn.com!news.xenologics.com!news From: Marcus Blaha <mbl@startext.de> Newsgroups: comp.lang.perl.misc,comp.lang.perl.modules,comp.lang.perl.tk,de.comp.lang.perl,fr.comp.lang.perl,pl.comp.lang.perl Subject: Re: dbase IV files to comma delimited files Date: Mon, 01 Dec 1997 10:45:54 +0100 Organization: startext GmbH Lines: 57 Message-ID: <34828752.7681@startext.de> References: <65s8vd$r1d@bgtnsc03.worldnet.att.net> Reply-To: mbl@startext.de NNTP-Posting-Host: 194.231.19.66 Mime-Version: 1.0 X-Mailer: Mozilla 3.01 (Win95; I) To: Akira <j.a.d.@worldnet.att.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit