±hide
Prevent one or more CSV columns from output
Description
This command ignores columns from reading (when input) or hides them from output (when writing).
The most simple case is hiding just one unwanted field.
But you can also enter a list of fields to hide. In this case, it will is a comma-separated list of CSV column names (or numbers), and can even include column ranges denoted with a hyphen.
Pattern
±hide[Fieldname]
±hide=[Fieldname]
±hide[AField],[AnotherField],...
±hide=[AField],[FirstOfMoreFields]-[LastOfMoreFields],...
Usage examples
This is the input file names.csv.City | FirstName | LastName | Birth | Driver License |
---|---|---|---|---|
Rome | Andrea | Bocelli | 1958 | y |
Los Angeles | Lieutnant | Columbo | 1927 | y |
London | Hercule | Poirot | 1910 | - |
New York | Theodoros | Kojak | 1922 | y |
- csvfox names.csv -hide[FirstName] lastnames.csv
-
This hides the column
FirstName . The resulting CSV table is written to lastnames.csv.lastnames.csv City LastName Birth Driver License Rome Bocelli 1958 y Los Angeles Columbo 1927 y London Poirot 1910 - New York Kojak 1922 y - csvfox names.csv -hide[3],[4] firstnames.csv
- This command hides the third and fourth column (
LastName andBirth ) of names.csv from output.firstnames.csv City FirstName Driver License Rome Andrea y Los Angeles Lieutnant y London Hercule - New York Theodoros y - csvfox names.csv -hide[FirstName]-[Birth] nonames.csv
- This command hides a range of three columns (
FirstName ,LastName , andBirth ) of names.csv from output.nonames.csv City Driver License Rome y Los Angeles y London - New York y
Hint
This command is meant for preventing output of one or a few CSV columns.
If you want to rearrange column output completely, or just write only a few of many columns, consider using ±columns instead.