+filetype
File type of the input file: CSV, TEXT, RECORD, or HTML
Description
Set the assumed file format for reading an input file.
The default format, if this command is not given, is CSV.
TEXT is a text format like CSV, but each line is a consists of the same number of fields with fixed field lengths. The record itself has therefore also a fixed length, and ends with one or two line break characters (\r, \n).
When being read, any trailing freespace inside the data fields will be trimmed automatically.
Reading a TEXT file additionally needs a +fixed statement to define the field lengths.
RECORD has fixed field lengths like TEXT, but there is no line break between the records. Each data record has also the same fixed length, and and they follow one another immediately and consecutively.
When being read, any trailing freespace inside the data fields will be trimmed automatically.
Reading a RECORD file additionally needs a +fixed statement to define the field lengths.
HTML finds a HTML table on a web page or inside a HTML text file. It extracts the field data from its <th> (column names) and <td> (column data) fields.
You might also want to remove all HTML markup from the fields data with ±htmlstrip.
Pattern
±filetype=filetype
Usage Examples
- csvfox infile.csv +filetype=csv (...)
- Assumes that the CSV file to read is a CSV file (default).
- csvfox infile.txt +filetype=text +fixed=2,35,35,35,35,10,4,18,8 +e=ASCII -e=UTF-8 outfile.csv
- Reads infile.txt in ASCII encoding, as a file with fixed record and field lengths.
Writes all data into outfile.csv as a CSV file with UTF-8 encoding.
Important: +fixed defines all field sizes and must also be defined!