Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Reusing Open Food Facts Data
(view source)
Revision as of 17:26, 14 May 2020
452 bytes added
,
17:26, 14 May 2020
Add examples with zcat
Line 91:
Line 91:
$ cat small.jsonl | jq -r .code # print all products' codes.
$ cat small.jsonl | jq -r .code # print all products' codes.
−
$ cat small.jsonl | jq -r '[.code,.product_name] | @csv' # output
a
CSV file containing code,product_name
+
$ cat small.jsonl | jq -r '[.code,.product_name] | @csv' # output CSV
data containing code,product_name
+
+
Then you can try on the whole database:
+
$ cat openfoodfacts-products.jsonl | jq -r '[.code,.product_name] | @csv' > names.csv # output CSV file (name.csv) containing all products with code,product_name
+
+
If you don't have enough disk place to uncompress the .gz file, you can use zcat directly on the compressed
file
. Example:
+
$ zcat openfoodfacts-products.jsonl.gz | jq -r '[.code,.product_name] | @csv' # output CSV data
containing code,product_name
Charlesnepote
Bureaucrats
,
Administrators
947
edits
Navigation menu
Personal tools
English
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Log in
Open Food Facts galaxy
Where am I?
Open Food Facts website
Open Food Facts wiki
Main page
Recent changes
Random page
Open Beauty Facts wiki
Main page
Whole wiki
Help about MediaWiki
Icons in the wiki
Tools
Special pages
Printable version
Admins
Edit sidebar
Styling
Replace text
Special Pages