-
-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathscript-09.sh
More file actions
executable file
·13 lines (8 loc) · 787 Bytes
/
script-09.sh
File metadata and controls
executable file
·13 lines (8 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
set -euo pipefail
# The input for this script is the scores.json file.
# TODO: Write a command to output just the names of each player along with the total scores from all of their games added together.
# Your output should contain 6 lines, each with one word and one number on it.
# The first line should be "Ahmed 15" with no quotes.
# [{"name": "Ahmed", "city": "London", "scores": [1, 10, 4]}, {"name": "Basia", "city": "London", "scores": [22, 9, 6]}, {"name": "Mehmet", "city": "Birmingham", "scores": [3, 12, 17]}, {"name": "Leila", "city": "London", "scores": [1]}, {"name": "Piotr", "city": "Glasgow", "scores": [15, 2, 25, 11, 8]}, {"name": "Chandra", "city": "Birmingham", "scores": [12, 6]}]
jq -r '.[] | .name + " " + (.scores | add | tostring)' scores.json