Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: allow join to read from stdin #178

Open
mloughran opened this issue May 8, 2019 · 2 comments
Open

Feature request: allow join to read from stdin #178

mloughran opened this issue May 8, 2019 · 2 comments

Comments

@mloughran
Copy link

For my current use case it would be extremely convenient to be able to pipe stdin to xsv join.

Example use case

xsv frequency -s typeId relationships.csv | xsv join value - id types.csv

It would also allow multiple joins to be piped together.

Potential interface: Since the filename arguments cannot be optional without breaking the interface, this could work similarly to cat for example, where - is used to signify stdin.

I have never written a line of rust, but happy to attempt a PR if this proposal seems sensible.

P.S. Thanks for an amazing tool!

@pol3waf
Copy link

pol3waf commented Jun 18, 2019

This feature would be very helpful in my work, too.
It would be great if you could use something like:
xsv join column_1 <( xsv search -s "argument_1" <my_file_1> ) column_2 <( xsv search -s "argument_2" <my_file_2> )
If I use this command, the first row (containing the headers) will be joined but then an "Illegal seek (os error 29)" error occurs.

Otherwise I would have to save the searches first and then perform a join on both files. In my case this is troublesome, because the my TSV files contain fields with JSON markup and xsv introduces more commas as delimiters than I can handle.
So yes, this feature would be great!

PS: A big thank you for this amazing tool!

@kyleflan
Copy link

Found this issue as I wanted to do the same thing as @mloughran.

This doesn't help @pol3waf's use case, but instead of using -, you can use /dev/stdin if you only need one file from stdin, e.g..

xsv search -s Population '[0-9]' worldcitiespop.csv \
    | xsv join --no-case Country /dev/stdin Abbrev countrynames.csv \
    | xsv select 'Country[1],AccentCity,Population' \
    | xsv sample 10 \
    | xsv table

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants