read_fixed

Commands ››
Parent Previous Next

The read_fixed command is used to convert fixed-format data into CSV. You specify the fields in the fixed-format input that you want to be converted.

See also: write_fixed

Flag

Req'd?

Description

-f fields

Yes

Specifies a comma-separated list of fields that you want to convert. Each field consists of a start position in the input, a colon separator and the width of the field. For example:

-f 4:10,20:2

says to read two fields from input, the first starting at position 4 and of length 10 and the second starting at position 20 and of length 2. Fields may overlap.

-k

No

Indicates that you want to keep any trailing spaces in the input values. making the output CSV field values all be of the same length. The default is to remove them.



The following example reads the fixed_names.dat file:

csvfix read_fixed -f 1:10,11:1 data/fixed_names.dat

which produces:

"Geraldine","F"
"Fred","M"
"Emmylou","F"

Created with the Personal Edition of HelpNDoc: Easily create CHM Help documents