Join two files on a specified common column

textql

  • Execute SQL against structured text like csv or tsv files.
    More information: <https://github.com/dinedal/textql>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

textql -header -sql "SELECT * FROM {{file1}} JOIN {{file2}} ON {{file1}}.{{c1}} = {{file2}}.{{c1}} LIMIT {{10}}" -output-header {{path/to/file1.csv}} {{path/to/file2.csv}}

click the source code to copy install textql on any operating system with command-not-found.com