the csv swiss army knife
  • Zig 67.8%
  • C 23.1%
  • Python 4.9%
  • Shell 4.2%
Find a file
2026-02-22 18:23:59 +01:00
src perf: don't store field data when it's unnecessary 2026-02-22 18:23:59 +01:00
.gitignore refactor: use idiomatic type names 2026-02-21 17:45:40 +01:00
.gitlab-ci.yml optimize for long fields 2025-11-13 10:26:54 +01:00
build.zig initial commit of zig rewrite 2025-11-08 17:41:42 +01:00
build.zig.zon make it pass the tests 2025-11-10 17:58:50 +01:00
cutcsv.c fix column match using strncmp incorrectly; bump to 0.2.4 2022-05-09 12:32:15 +02:00
LICENSE fix incorrect allocation; bump to 0.2.2 2022-04-26 13:42:10 +02:00
README initial commit of zig rewrite 2025-11-08 17:41:42 +01:00
test.py change to fsm 2025-11-11 00:05:58 +01:00
tool improve flag parser, add gitlab ci 2021-03-18 23:43:16 +01:00

dev/zig-rewrite branch

This branch is being used to rewrite the cutcsv source in Zig, mostly as a
learning exercise :)

--------------------------------------------------------------------------------

cutcsv - the csv swiss army knife (version 0.2.3)

Usage: cutcsv OPTION... [FILE...]
Print selected CSV fields from each specified FILE to standard output.
Select one or more fields using -c and/or -f. At least one must be selected.
With no FILE, or when FILE is -, read standard input.

        -f <LIST>   Print the specified comma-separated list of fields or ranges
        -c <COLUMN> Select fields whose column name (value of the first line)
                    matches COLUMN.
        -d <CHAR>   Use CHAR as a delimiter (defaults to ',')
        -D <STRING> Use STRING as the output separator (in case of multiple fields).
                    Defaults to the input delimiter.
        -r          Skip one row from the top of the file (header).
        -h          Show this help message.
        -v          Be verbose

Each LIST is made up of one range, or many ranges separated by commas,
in a similar fashion to the UNIX 'cut' program.
Selected input is written in the same order that it is read, and is written
exactly once. Each range is one of:

  N     N'th field, counted from 1
  N-    from N'th field, to end of line
  N-M   from N'th to M'th (included) field
  -M    from first to M'th (included) field

https://zxq.co/rosa/cutcsv
Copyright (c) 2021-2022 Morgan Bazalgette <the@howl.moe> under the MIT license

Installation:
	Build script will work with gcc. There are no external dependencies.
	Clone the repository, and run `./tool build`, then move the file to wherever
	you want (`~/bin`, or `/usr/bin` typically.)