-
-
Notifications
You must be signed in to change notification settings - Fork 42
London | 25-SDC-July | Andrei Filippov | Sprint 2 | jq exercises #106
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,4 @@ set -euo pipefail | |
| # The input for this script is the scores.json file. | ||
| # TODO: Write a command to output the total of adding together all scores from all games from all players. | ||
| # Your output should be exactly the number 164. | ||
| jq '[.[].scores] | add | add' scores.json | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your solution of constructing a new json object and joining it works, but you could probably simplify it a bit. Do you know how to directly build a string in a
jqcommand?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, cool. I didn't know that I can concatenate strings in jq, but now I know that I need to use
+operator to do it.