CSVfox
Get the job done.
 English

±columns

Rearrange CSV table columns for input or output

Description

This command rearranges the table columns from reading (when input) or for output (when writing).
It defines which columns in which order shall be processed further and returned. It is also possible to omit some columns, and give a subset of all columns in a different order.

You can specify a comma-separated list of fields for output.
And you can also specify column ranges denoted with a hyphen. This way, all fields in between will be handled as if they were listed explicitly in their order.

Pattern

±columns=[Field],[NextField],[OneMoreField] ... ±columns=[Field],[FieldFrom]-[FieldTo],...

Usage examples

This is the input file names.csv.
names.csv
CityFirstNameLastNameBirthDriver License
RomeAndreaBocelli1958y
Los AngelesLieutnantColumbo1927y
LondonHerculePoirot1910-
New YorkTheodorosKojak1922y
csvfox names.csv -columns=[City],[LastName],[Birth],[Driver License] nofirstnames.csv
This denotes all columns in the original order, but omits the column FirstName. The resulting CSV table is written to nofirstnames.csv.
nofirstnames.csv
CityLastNameBirthDriver License
RomeBocelli1958y
Los AngelesColumbo1927y
LondonPoirot1910-
New YorkKojak1922y
csvfox names.csv -columns=[Driver License],[Birth],[LastName],[City] reverse_nofirstnames.csv
This reverses all columns order, and again omits the column FirstName. The resulting CSV table is written to reverse_nofirstnames.csv.
reverse_nofirstnames.csv
Driver LicenseBirthLastNameCity
y1958BocelliRome
y1927ColumboLos Angeles
-1910PoirotLondon
y1922KojakNew York
csvfox names.csv -columns=[City]-[LastName] city_names.csv
This command defines a range of three columns ( City, FirstName, and LastName) and the filename city_names.csv for output.
city_names.csv
CityFirstNameLastName
RomeAndreaBocelli
Los AngelesLieutnantColumbo
LondonHerculePoirot
New YorkTheodorosKojak

[Also an example for -columns=1,2,3,4,7 ?]

Hint

This command is meant for rearranging column output completely, or for writing only a few of many columns.
If you just want to prevent output of one or two CSV columns, consider using ±delete instead.

Under construction, coming soon