-
-
Notifications
You must be signed in to change notification settings - Fork 92
West Midlands | 26 March SDC | Iswat Bello | Sprint 2 | jq exercises #410
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 3 commits
974363c
70e7660
b5f6bfd
0bff639
fba7258
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 |
|---|---|---|
|
|
@@ -6,3 +6,9 @@ set -euo pipefail | |
| # TODO: Write a command to output just the names of each player along with the score from their first attempt. | ||
| # Your output should contain 6 lines, each with one word and one number on it. | ||
| # The first line should be "Ahmed 1" with no quotes. | ||
|
|
||
| jq -r '.[] | "\(.name) \(.scores[0])"' scores.json | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, one simpler option is |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,6 @@ set -euo pipefail | |
| # TODO: Write a command to output just the names of each player along with the score from their last attempt. | ||
| # Your output should contain 6 lines, each with one word and one number on it. | ||
| # The first line should be "Ahmed 4" with no quotes. | ||
|
|
||
| jq -r '.[] | "\(.name) \(.scores[-1])"' scores.json | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, one simpler option is |
||
|
|
||
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.
Can you think of another way to achieve the same without the slashes and brackets to improve readability?
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.
Yes, one simpler option is
jq -r '.[] | .name + " " + .city' ./scores.json