Wiki source for CommandFixed2xml

Show raw source

======Command fixed2xml======

**fixed2xml** converts a fixed field width file to an xml file

csv2xml [ [[SerializationOptions serialization options]] ] [options] [fixedfile]

||-root rootname||use "rootname" as the root element name, default "root"||
||-row rowname||use "rowname" as each row's element name, default "row"||
||-col colname||use "colname" as each column's element name (or for attribute normal format, the attribute prefix)||
||-colspecs specs||sequence or , delimited list of column specs||
||-colnames names||Use a sequence or "," delimited list of strings to specify the column names||
||-encoding encoding||read csv file in encoding (default "cp1252")||
||-header||read 1 row from the csv file and use as column names (element or attribute)||
||-attr||Output in attribute normal format (each column is an attribute), default row normal format||
||-nonorm||"No Normalize" ... Do NOT trim leading and trailing blanks from fields (defaults to normalize)||
||-skip lines||Skip "lines" of lines before reading header or row data||
||fixedfile||Name of the fixed file to convert, otherwise stdin. Default "-" (stdin)||

Supports the standard [ [[SerializationOptions serialization options]] ]

If -colnames is specified, its argument is taken to be either a sequence of strings, or a single string which is "," seperated which specifieds the column names to be used.
if -header is specified then the first row of the fixed file is read and the values used as column names.

-colspecs is required. Its argument is a sequence or "," deliminted string of column specs. A column spec is either "start-end" or "start", where start and end are integer column positions starting at one. For example "1-3,5-6,7-9" or <[ "1-3" , "5-6" , "7-9" ]>
If the "-end" is omitted then the remainder of the line is used.
Column specs may overlap (e.g "1-10,5-12" )

Convert a file with 3 fields of widths 6,4,4 and field names First, Second, Third to xml

fixed2xml -row item -root items -colspecs 1-5,7-9,11-15 -colnames First,Second,Third <<EOF

====Return Value====
Returns 0 if the conversion is successful

Valid XHTML :: Valid CSS: :: Powered by WikkaWiki