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

Update exporting.md jq script to make cleaner CSVs #208

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/using/exporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ The archive will contain a few items:

You can use the `jq` tool to convert the JSON files to CSV:

To create a single column CSV with all your urls, in the directory with your json files:
To create a single column CSV (`output.csv`) with all your urls, in the directory with your json files:

```
jq -r '.[].url' *.json
jq -r '.[].url' *.json > output.csv
```

To create a CSV that also contains your labels, you can use this command:
To create a CSV (`output.csv`) that also contains your labels in a second column, you can use this command:

```
jq -r '[.[] | {url: .url, labels: (.labels | join(","))} | "\(.url),\"\(.labels)\""] | @csv' *.json
jq -r '.[] | [.url, (.labels | join(","))] | @csv' *.json > output.csv
```