inter

Commands ››
Parent Previous Next

The inter command is used to interleave fields from two (and only two) CSV sources. The command reads a row from each sources, and then interleaves as specified by the -f flag. Reading stops when the first (left-hand) source is exhausted. If no -f flag is specified, the command appends the data from the second (right-hand) source to that from the first.

See also: order

Flag

Req'd?

Description

-f fields

No

Comma-separated list which specifies the order of the fields. This works in a way similar to the order command, but the field specifications are prefixed by an indicator of which source to read from. So L3 means the third field from the first, left-hand source, while R1 means the first field of the second, right-hand source.

If no -f flag is specified, all fields from the second source are appended to all fields from the first.




The following example interleaves field 2 from the second source between fields 1 and 3 of the first source, using names.csv and dates.csv as input:

csvfix  inter  -f L1,R2,L3 data/names.csv data/dates.csv

producing:

"Charles","1/12/1980","M"
"Jane","23/4/1964","F"
"Herman","3/3/1878","M"
"Flann","Not A Date","M"
"George","","F"
"Virginia","","F"
"Oscar","","M"

Created with the Personal Edition of HelpNDoc: Easy to use tool to create HTML Help files and Help web sites