https://github.com/flightaware/tsvcut-c
cut out specific fields from a TSV (tab separated values) file containing alternating key-value pairs
https://github.com/flightaware/tsvcut-c
command-line-tool cut tsv
Last synced: 11 months ago
JSON representation
cut out specific fields from a TSV (tab separated values) file containing alternating key-value pairs
- Host: GitHub
- URL: https://github.com/flightaware/tsvcut-c
- Owner: flightaware
- License: bsd-3-clause
- Created: 2017-08-11T14:20:09.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-08-17T20:53:41.000Z (almost 5 years ago)
- Last Synced: 2024-11-08T21:39:22.518Z (over 1 year ago)
- Topics: command-line-tool, cut, tsv
- Language: C
- Size: 8.79 KB
- Stars: 2
- Watchers: 7
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tsvcut-c
_Native C version of bovine/tsvcut_
This is a simple command-line program to cut out specific fields from
a TSV (tab separated values) file and return just those values. Its
behavior is inspired by the UNIX cut(1) command, but is specifically
tailored for the TSV file format.
All TSV input files are expected to be lines of alternating
key-value pairs that are separated by tab characters. The ordering of
fields can be vary between lines, as long as consistent field names
are used. Some lines may include fields that are not present on other
lines. For example:
````
color blue fruit blueberry price 1.99
color red fruit strawberry price 3.99 sale 2.99
color yellow price 2.49 fruit banana
````
## Options
-t Output column names inline, retaining the key-value format... null columns are not output
-h Output column names as header
-n NULL Output NULL string as null
## Examples
The tsvcut command should be run with the list of desired fields on
its command-line, and the TSV file supplied as stdin (using
redirection or pipes):
tsvcut color price < fruits.tsv
blue 1.99
red 3.99
yellow 2.49
If you specify the -t option, then you will receive the field names too:
tsvcut -t color price < fruits.tsv
color blue price 1.99
color red price 3.99
color yellow price 2.49
## Notes
Maximum line length is 1MB