eBay / tsv-utils

eBay's TSV Utilities: Command line tools for large, tabular data files. Filtering, statistics, sampling, joins and more.
https://ebay.github.io/tsv-utils/
Boost Software License 1.0
1.43k stars 80 forks source link

fieldlists: Detect mixed numeric and named field ranges (not supported). #290

Closed jondegenhardt closed 4 years ago

jondegenhardt commented 4 years ago

This PR adds a missed error detection case in the new fieldlist support (named fields). The case occurs when a field range is entered that contains both numeric and non-numeric elements. e.g.

$ tsv-select --header -f field3-7

Prior to this change the second component, the 7 is marked as and searched for in the file header. Typically it won't be found and an error message generated, but a misleading error message. If found, it generally won't be what was intended.

This PR detects this case and generates the correct error message. Note that in the above example, if there really is a field named 7, the way to designate it is:

$ tsv-select --header -f `field3-\7`

This is part of the named field PR series starting with #284. Enhancement request #25.