BurntSushi / xsv

A fast CSV command line toolkit written in Rust.
The Unlicense
10.31k stars 317 forks source link

Missing step in whirlwind demo of join #246

Closed lhayhurst closed 2 years ago

lhayhurst commented 3 years ago

Hi, I was working through the whirlwind demo and I think there is a missing step in the join section of the demo.

xsv join --no-case  Country sample.csv Abbrev countrynames.csv | xsv table

In the search command prior, there is no output to sample.csv.

xsv search -s Population '[0-9]' worldcitiespop.csv \
  | xsv select Country,AccentCity,Population \
  | xsv sample 10 \
  | xsv table

As an aside, I tried to fix it with this:

xsv search -s Population '[0-9]' worldcitiespop.csv \
  | xsv select Country,AccentCity,Population \
  | xsv sample 10 \
  | xsv table -o sample.csv

And then did the join, but am getting an error message:

$ xsv headers sample.csv
1   Country  AccentCity   Population
$ xsv join --no-case  Country sample.csv Abbrev countrynames.csv 
Selector name 'Country' does not exist as a named header in the given CSV data.

Thank you in advance, xsv is amazing.

lhayhurst commented 3 years ago

I was able to fix the join issue by doing this:

xsv search -s Population '[0-9]' worldcitiespop.csv \
  | xsv select Country,AccentCity,Population \
  | xsv sample 10 > sample.csv