Command line usage¶
PortaBase can be used from a Linux/UNIX terminal or DOS prompt to import or export data without needing to go through the graphical interface. This can be particularly useful if you want to write scripts that automatically generate, update, or otherwise manipulate PortaBase data files. Run portabase -h
for usage instructions; in summary, you can do the following:
portabase file
- Launch PortaBase and immediately open the named PortaBase data file.
portabase fromxml xmlfile pobfile
- Create a new PortaBase data file at pobfile from the PortaBase-format XML file located at xmlfile.
portabase fromcsv csvfile pobfile
- Add rows to the existing PortaBase data file at pobfile from the CSV file located at csvfile.
portabase frommobiledb mdbfile pobfile
- Create a new PortaBase data file at pobfile from the MobileDB file located at mdbfile.
portabase toxml pobfile xmlfile
- Create a new XML file at xmlfile from the PortaBase data file located at pobfile.
portabase tocsv pobfile csvfile
- Create a new CSV file at csvfile from rows in the PortaBase data file located at pobfile.
portabase tohtml pobfile htmlfile
- Create a new HTML file at htmlfile from rows in the PortaBase data file located at pobfile.
To extract data from, add rows to, or create an encrypted file, type -p password
immediately after the conversion command (before the other options described below).
The following options can be used between toxml
, tocsv
, or tohtml
and the PortaBase file to export from:
-v view | Apply the named view before exporting. |
-s sorting | Apply the named sorting before exporting. |
-f filter | Apply the named filter before exporting. |
The following options can be used with either fromcsv
or tocsv
:
--headers | There is or should be a row of column headers |
-d delimiter | The field delimiter character (typically ‘tab’ if not using the default ‘,’) |
-e encoding | Parse or write the CSV file using the specified text encoding (the default is UTF-8) |
There’s one additional option for fromcsv
:
--add-unknown-enum-options | |
Automatically add new enum values encountered |
There’s also one additional option for tocsv
:
-l line_ending | “crlf” to use Windows-style carriage return + newline, default is UNIX/Mac-style (newline only) |
For more information about the PortaBase XML format and tools for doing useful things with it, see the PortaBase homepage (http://portabase.sourceforge.net).