🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.perl
5 messages
5 total messages Started by Akira Sun, 30 Nov 1997 00:00
dbase IV files to comma delimited files
#732
Author: Akira
Date: Sun, 30 Nov 1997 00:00
9 lines
695 bytes
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
Re: dbase IV files to comma delimited files
#733
Author: Grzegorz BRZESKI
Date: Sun, 30 Nov 1997 18:10
9 lines
875 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??

XBase.

--
Grzegorz BRZESKI - WEB Corporation Polska Sp. z o.o.
Re: dbase IV files to comma delimited files
#734
Author: Mike King
Date: Mon, 01 Dec 1997 00:48
12 lines
1340 bytes
On Sun, 30 Nov 1997 12:43:13 -0500, "Akira" <j.a.d.@worldnet.att.net>
wrote:

>Does anyone have a script that will take a dbase IV file and convert it to a
>comma delimited file using Perl 5??

No, but I have some 'C' code which I think will work for you.

The dBase format is very simple- just fixed width columns. The first
record in the file will give you the column names and widths.

Mike
Re: dbase IV files to comma delimited files
#735
Author: Marcus Blaha
Date: Mon, 01 Dec 1997 09:45
57 lines
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
#################################################################
Re: dbase IV files to comma delimited files
#736
Author: Honza Pazdziora
Date: Mon, 01 Dec 1997 10:00
19 lines
1433 bytes
"Akira" <j.a.d.@worldnet.att.net> writes:

> Does anyone have a script that will take a dbase IV file and convert it to a
> comma delimited file using Perl 5??

use XBase;
my $table = new XBase("table.dbf") or die XBase->errstr();
$table->dump_records();
__END__

You can get XBase.pm from CPAN, it's in DBD-XBase-x.xx.tar.gz package.

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads