dbfsak(1)

NAME
dbfsak - xBase files Swiss Army Knife

SYNOPSIS
dbfsak OPTIONS filename

DESCRIPTION
This program does various things with and to xBase (dBase/FoxPro/Clipper) files.

OPTIONS
The following options are available (unless otherwise specified, output goes to STDOUT):

-a rdbfile
    Append records to xBase file from nosql/rdb file.

-b  This dumps the records themselves, their contents.

-d fieldsep
    This specifies the field separator character when dumping record contents. By default, this is the pipe symbol (|). You may specify the tab character (0x09) by "\t".

-e  Dump the field descriptions.

-h  Show help.

-i  Dump header information, such as how many records, etc.

-n nsqlstructfile
    Dump table to NoSQL database file. This also creates a NoSQL structure file named for the parameter above. Structure of this file is as in option -r below.

-r nsqlfile
    Make dbf from a NoSQL table file. The table must have four fields, in the following order: field name, field type, field length and field decimals. The names of the fields are irrelevant, but they must be in that order.

-s  Dump the records in PostgreSQL SQL COPY format. Without this option, records are simply dumped in human-readable format. This option is meaningless without the inclusion of the -b, -e or -i flags as well.

-m  Dump the records in MySQL format. May be COPY or INSERT format, depending on the -m flag. See below.

-S  Dump the records in SQL INSERT format. Assumes PostgreSQL format unless the -m flag is also specified. See above.

-t  Specifies that the record dumps (human readable format) will have all unnecessary leading and trailing spaces deleted for each field. Normally, record dumps contain leading and trailing spaces as indicated by the size and type of field.

-v  Show version number.

-x  Omit records marked for deletion.

ENVIRONMENT

None.

FILES
/usr/local/bin/dbfsak

EXAMPLES
For dbview compatibility, run the program this way:

    dbfdump -b myfile.dbf

To change the field separator character, for example:

    dbfdump -bd @ myfile.dbf

To dump to a PostgreSQL-compatible SQL script:

    dbfdump -s - b -e -i myfile.dbf or dbfdump -sieb myfile.dbf

To do a "pack" like dBase and others do (actually delete records marked for deletion):

    dbfsak -xn struct.rdb myfile.dbf > result.rdb dbfsak -r struct.rdb new.dbf dbfsak -a result.rdb new.dbf

HISTORY
I wrote this program to replace the dbview program that Midnight Commander uses to view dbf files. The dbview program is apparently very old code, resurrected and only slightly modified. Unfortunately, it often doesn't work for me.

AUTHORS
Paul M. Foster <paulf@quillandmouse.com>

BUGS

When dumping out to a SQL script, the script includes the username of the user in the script. However, when called under Midnight Commander, the system call that returns the user name apparently only returns a NULL. Go figure. Also, no attempt has been made to encompass all brands of xBase files. The current program works with dBase III, FoxPro and Visual FoxPro files, and Clipper files.