miller icon indicating copy to clipboard operation
miller copied to clipboard

Is it possible to join using stdin?

Open aborruso opened this issue 5 years ago • 2 comments

Hi, in the join command it's mandatory to set -f, then to set a filename.

Is it possible to do something like:

<input do something | mlr --csv join -j id  -f stdin anotherFile

And is it possible to do something like this (apply a Miller verb before joining):

mlr --csv millerVerb file1 then join -j id -f millerVerbOutput anotherFile

Thank you

aborruso avatar Jan 26 '20 08:01 aborruso

First one: currently it's not but I can look into it. I'd need to error out immediately if the command line specifies main input from stdin and join input from stdin, but, other than that it should work (with some code changes). Oh also, risk of confusion if one does two joins both taking input from stdin -- behavior would be weird.

As for the second: yes you can do that but file1 needs to go at the end.

http://johnkerl.org/miller/doc/cookbook.html#Doing_multiple_joins

johnkerl avatar Jan 26 '20 14:01 johnkerl

@aborruso I figured out a workaround.

you can use the proc system, like this mlr --icsv --ojson tail -n 2 /proc/self/fd/0

https://xbin.io/w/tool/mlr

laixintao avatar May 10 '22 16:05 laixintao