Need BASH scriptable method to import DBFs into PGSQL on Linux

Posted on 2004-10-21
Last Modified: 2012-06-27
I need to import DBFs into a Linux-based PostGRES database. I'm looking for a simple command line utility or script that I can incorporate into my bash scripts that run right on the server. I'm not looking for a commercial package or a GUI, just a simple command-line utility. I'd prefer NOT to use ODBC. I figure there must be a way to do this with XBase commands and tab files or something.
Any suggestions?
Question by:billmercer
    LVL 9

    Accepted Solution

    Mandrake, SuSE, and Debian all have a command, dbf2pg, in their respective "postgresql-contrib" packages that copies data from DBF files into a table of your choice. Run "dbf2pg --help" for details.

    Alternatively, you can convert the DBF's into CSV files and then use the PostgreSQL COPY command to copy the file data into tables. You can generate your own script pretty easily.
    LVL 22

    Assisted Solution

    by:earth man2
    dbf2pg can be found in postgresql source distribution in contrib/dbase directory
    LVL 19

    Author Comment

    Excellent! Rjkimble, this is exactly the information I needed. And earthman2 read my mind and answered my followup question before I had a chance to ask it.
    Thank you both!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Suggested Solutions

    Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: ( This requires some add-o…
    Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
    Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now