Need BASH scriptable method to import DBFs into PGSQL on Linux

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?
LVL 19
billmercerAsked:
Who is Participating?
 
rjkimbleCommented:
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.
0
 
earth man2Commented:
dbf2pg can be found in postgresql source distribution in contrib/dbase directory
0
 
billmercerAuthor Commented:
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!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.