#csv-tsv #separated #values #filtering #search #grep #utility

bin+lib svgrep

A grep-like utility for separated-values files written in Rust

9 stable releases

2.1.2 Aug 2, 2021
2.1.1 May 25, 2021
2.1.0 Feb 14, 2021
2.0.1 Sep 26, 2020
1.0.0 Nov 10, 2017

#2359 in Command line utilities

Download history 24/week @ 2024-02-25 2/week @ 2024-03-10 70/week @ 2024-03-31

72 downloads per month

GPL-3.0+

35KB
291 lines

SVGrep (Separated Values Grep)

builds.sr.ht status latest release License GPL 3 or later

svgrep is a small utility for filtering and searching in separated values files (CSV, TSV, whatever).

Here is its synopsis:

USAGE:
    svgrep [FLAGS] [OPTIONS] [--] [FILE]

FLAGS:
    -h, --help       Prints help information
    -t, --trim       Trim the cell contents when printing.
    -V, --version    Prints version information

OPTIONS:
    -@, --cell-select-char <char>  Separates the <col>=<regex> pairs in --match expressions from
                                   the column display selection (default: @).
    -&, --conj-char <char>         Separates multiple <col>=<regex> pairs in --match expressions
                                   to form a conjunction (default: &).
    -m, --match <match>...         Sets the match-and-select expression.
                                     
                                   Syntax:
                                   <col>=<regex>(&<col>=<regex>)+@<disp_cols>
                                   <col> is a natural number or * meaning any column.
                                   <regex> is a regex matched against the cells at column <col>.
                                   <disp_cols> is a comma-separated list of columns to display (defaul: all).
                                     
                                   --match '1=foo&2=bar' acts as logical AND wheras multiple expressions like
                                   --match '1=foo' '2=bar' act as a logical OR.
    -=, --matches-char <char>      Separates a <col> from the <regex> in --match expressions.
                                   (default: =).
    -s, --separator <char>         Sets the separator to be used (default: ';')

ARGS:
    <FILE>    The separated values file. If none is given, reads from stdin.

Questions & Patches

For asking questions, sending feedback, or patches, refer to my public inbox (mailinglist). Please mention the project you are referring to in the subject.

Bugs

If you've found a bug, please report it at ~tsdh/svgrep.

Build status

builds.sr.ht status

License

GPLv3 or later

Dependencies

~2.5–3.5MB
~59K SLoC