Crates.io | rjoin |
lib.rs | rjoin |
version | 0.2.0 |
source | src |
created_at | 2017-09-14 06:52:23.432473 |
updated_at | 2018-02-05 12:40:37.745746 |
description | A tool for joining CSV data on command line. |
homepage | https://github.com/milancio42/rjoin |
repository | |
max_upload_size | |
id | 31687 |
size | 72,412 |
rjoin is a new command line utility for joining records of two files on common fields.
Dual-licensed under MIT or unlicense
The binary name for rjoin is rj
.
$ cargo --version
cargo 0.25.0-nightly (a88fbace4 2017-12-29) # requires nightly channel
$ RUSTFLAGS="-C target-cpu=native" cargo install rjoin
(don't forget to add $HOME/.cargo/bin
to your path).
rjoin
?rjoin
?awk
.tr
utility.Let's suppose we have the following data:
$ cat left
color,blue
color,green
color,red
shape,circle
shape,square
$ cat right
altitude,low
altitude,high
color,orange
color,purple
To get the lines with the common key:
$ rj left right
color,blue,orange
color,blue,purple
color,green,orange
color,green,purple
color,red,orange
color,red,purple
Some comments:
--key/-k
option (even per file).
rj
supports multiple fields as the key, but the number of key fields in both files must be equal.--show-left/-l
, --show-right/-r
or --show-both/-b
. Note however, if you use any of these options, the default behavior
is reset (e.g. if you want to see the unmatched lines in the left file along with the matched lines, use -lb
. With -l
you will not see the matched lines.)To get the lines with the unmatched key in both files:
$ rj -lr left right
altitude,low
altitude,high
shape,circle
shape,square
Check the tutorial for the detailed walkthrough.
Any kind of contribution (e.g. comment, suggestion, question, bug report and pull request) is welcome.
Because C eats a bloody lot of mental resources only to avoid shooting my leg, or worse.
The CSV parser used in Rjoin is based on the work of Y. Li, N. R. Katsipoulakis, B. Chandramouli, J. Goldstein, and D. Kossmann. Mison: a fast JSON parser for data analytics. In VLDB, 2017.
The SIMD part was shamelessly copied from pikkr
And finally a big thanks to BurntSushi for his excellent work.