Skip to content

Instantly share code, notes, and snippets.

@gwpl
Created January 31, 2017 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwpl/58bff94fd84efb55cfa21430c9202732 to your computer and use it in GitHub Desktop.
Save gwpl/58bff94fd84efb55cfa21430c9202732 to your computer and use it in GitHub Desktop.
csvsql_inventory_join.sh example of csvsql sql query joining scanned barcodes with bardcodes database into more meaningful output
id name
23 Toy T
44 Movie M2
68 Music CD 2
| id | name |
| -- | ---------- |
| 23 | Toy T |
| 44 | Movie M2 |
| 68 | Music CD 2 |
csvsql \
--query "select i.id, name from
items as i join inventory_mini as v
on (i.id = v.id)" \
items.csv inventory_mini.csv \
| tee csvsql_inventory_join.output.csv \
| csvlook | tee csvsql_inventory_join.output.csvlook.txt
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
id
44
23
68
id name
23 Toy T
45 Movie M1
44 Movie M2
43 Movie M3
67 Music CD 1
68 Music CD 2
69 Music CD 3
70 Music CD 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment