From ae91199cd5737b0a5cc4456d300b56d976e252cb Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 09:49:52 +0200 Subject: [PATCH 01/31] Complete script-01: list files using ls --- individual-shell-tools/ls/script-01.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/ls/script-01.sh b/individual-shell-tools/ls/script-01.sh index 241b62f5e..044af3619 100755 --- a/individual-shell-tools/ls/script-01.sh +++ b/individual-shell-tools/ls/script-01.sh @@ -12,4 +12,5 @@ if [[ "${script_dir}" != "$(pwd)" ]]; then fi # TODO: Write a command to list the files and folders in this directory. +ls # The output should be a list of names including child-directory, script-01.sh, script-02.sh, and more. From ef0f502fce0ea26f4516fb43aaab23264fbd4ceb Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 09:54:30 +0200 Subject: [PATCH 02/31] Complete script-02: list files inside child-directory --- individual-shell-tools/ls/script-02.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/ls/script-02.sh b/individual-shell-tools/ls/script-02.sh index d0a5a10f4..33e4b10bc 100755 --- a/individual-shell-tools/ls/script-02.sh +++ b/individual-shell-tools/ls/script-02.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command which lists all of the files in the directory named child-directory. +ls child-directory # The output should be a list of names: helper-1.txt, helper-2.txt, helper-3.txt. From 2821b9f6356d1d83e3c817b6bc36033868f4007b Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 10:01:02 +0200 Subject: [PATCH 03/31] Complete script-03: recursively list files with ls -R --- individual-shell-tools/ls/script-03.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/ls/script-03.sh b/individual-shell-tools/ls/script-03.sh index 781216d21..0dc1c2f8a 100755 --- a/individual-shell-tools/ls/script-03.sh +++ b/individual-shell-tools/ls/script-03.sh @@ -3,5 +3,6 @@ set -euo pipefail # TODO: Write a command which _recursively_ lists all of the files and folders in this directory _and_ all of the files inside those folders. +ls -R # The output should be a list of names including: child-directory, script-01.sh, helper-1.txt (and more). # The formatting of the output doesn't matter. From f6a8b2b7b9d7a509b2107badcd32b62a65638a58 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 10:05:30 +0200 Subject: [PATCH 04/31] Complete script-04: sort files by modification time --- individual-shell-tools/ls/script-04.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/individual-shell-tools/ls/script-04.sh b/individual-shell-tools/ls/script-04.sh index 72f3817b3..20cf11a40 100755 --- a/individual-shell-tools/ls/script-04.sh +++ b/individual-shell-tools/ls/script-04.sh @@ -14,10 +14,12 @@ touch "${script_dir}/child-directory/helper-3.txt" echo "First exercise (sorted newest to oldest):" # TODO: Write a command which lists the files in the child-directory directory, one per line, sorted so that the most recently modified file is first. +ls -t child-directory # The output should be a list of names in this order, one per line: helper-3.txt, helper-1.txt, helper-2.txt. echo "Second exercise (sorted oldest to newest):" # TODO: Write a command which does the same as above, but sorted in the opposite order (oldest first). +ls -tr child-directory # The output should be a list of names in this order, one per line: helper-2.txt, helper-1.txt, helper-3.txt. From dea11344caddc85646f2db48cc0026aec485456f Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 10:14:27 +0200 Subject: [PATCH 05/31] Fix path for cat script-01 using relative path --- individual-shell-tools/cat/script-01.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/cat/script-01.sh b/individual-shell-tools/cat/script-01.sh index c85053e0f..682b379b6 100755 --- a/individual-shell-tools/cat/script-01.sh +++ b/individual-shell-tools/cat/script-01.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output the contents of the helper-1.txt file inside the helper-files directory to the terminal. +cat ../helper-files/helper-1.txt # The output of this command should be "Once upon a time...". From cf02aa7c72af9a30c8c5711a3fddb541fd1e28a8 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 10:20:42 +0200 Subject: [PATCH 06/31] Complete cat script-02: output all files using wildcard --- individual-shell-tools/cat/script-02.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/cat/script-02.sh b/individual-shell-tools/cat/script-02.sh index 01bbd5eab..4e53fab51 100755 --- a/individual-shell-tools/cat/script-02.sh +++ b/individual-shell-tools/cat/script-02.sh @@ -3,6 +3,7 @@ set -euo pipefail # TODO: Write a command to output the contents of all of the files inside the helper-files directory to the terminal. +cat ../helper-files/* # Make sure you are only calling `cat` once. # # The output of this command should be: From ba015ecd2df917fe7931f12f9c6db84d997e4a99 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 10:22:45 +0200 Subject: [PATCH 07/31] Complete cat script-03: add line numbers --- individual-shell-tools/cat/script-03.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/cat/script-03.sh b/individual-shell-tools/cat/script-03.sh index 37573b0c1..05957a5a4 100755 --- a/individual-shell-tools/cat/script-03.sh +++ b/individual-shell-tools/cat/script-03.sh @@ -3,6 +3,7 @@ set -euo pipefail # TODO: Write a command to output the contents of the file `helper-3.txt` inside the helper-files directory to the terminal. +cat -n ../helper-files/helper-3.txt # This time, we also want to see the line numbers in the output. # # The output of this command should be something like: From 77b14dd4816183fc3d0b09d9535753a165532793 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 10:26:55 +0200 Subject: [PATCH 08/31] Complete cat stretch: continuous line numbering --- individual-shell-tools/cat/script-04-stretch.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/cat/script-04-stretch.sh b/individual-shell-tools/cat/script-04-stretch.sh index 00fe3c48b..2ee27f812 100755 --- a/individual-shell-tools/cat/script-04-stretch.sh +++ b/individual-shell-tools/cat/script-04-stretch.sh @@ -5,6 +5,7 @@ set -euo pipefail # NOTE: This is a stretch exercise - it is optional. # TODO: Write a command to output the contents of all of the files in the helper-files directory to the terminal. +cat -n ../helper-files/* # We also want to see the line numbers in the output, but we want line numbers not to reset at the start of each file. # # The output of this command should be something like: From 48ff1640fba3e4ff37a33a52b01e0196303d8f7d Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 10:37:36 +0200 Subject: [PATCH 09/31] Complete wc script-01: count words --- individual-shell-tools/wc/script-01.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/wc/script-01.sh b/individual-shell-tools/wc/script-01.sh index c9dd6e5df..0734bdb02 100755 --- a/individual-shell-tools/wc/script-01.sh +++ b/individual-shell-tools/wc/script-01.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output the number of words in the file helper-files/helper-3.txt. +wc -w ../helper-files/helper-3.txt # The output should include the number 19. The output should not include the number 92. From 0ccab23dd86de8b390261a31b1aa6793aad04603 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 10:40:46 +0200 Subject: [PATCH 10/31] Complete wc script-02: count lines --- individual-shell-tools/wc/script-02.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/wc/script-02.sh b/individual-shell-tools/wc/script-02.sh index 8feeb1a62..8da91ac5e 100755 --- a/individual-shell-tools/wc/script-02.sh +++ b/individual-shell-tools/wc/script-02.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output the number of lines in the file helper-files/helper-3.txt. +wc -l ../helper-files/helper-3.txt # The output should include the number 3. The output should not include the number 19. From 2994913eee34960e95a110ce222a442240d84e90 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 10:46:33 +0200 Subject: [PATCH 11/31] Complete wc script-03: count lines, words, chars --- individual-shell-tools/wc/script-03.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/wc/script-03.sh b/individual-shell-tools/wc/script-03.sh index 6b2e9d3d1..8d6e919e1 100755 --- a/individual-shell-tools/wc/script-03.sh +++ b/individual-shell-tools/wc/script-03.sh @@ -3,6 +3,7 @@ set -euo pipefail # TODO: Write a command to output the number of lines, words, and characters in all of the files inside the helper-files directory. +wc ../helper-files/* # The output should be something like: # 1 4 20 ../helper-files/helper-1.txt # 1 7 39 ../helper-files/helper-2.txt From 534ddedda727ad4be063c4f3dd1e97a0eb6a3bbc Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 10:56:44 +0200 Subject: [PATCH 12/31] Fix grep script-01: only Doctor lines --- individual-shell-tools/grep/script-01.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/grep/script-01.sh b/individual-shell-tools/grep/script-01.sh index fb05f42f2..0133948ec 100755 --- a/individual-shell-tools/grep/script-01.sh +++ b/individual-shell-tools/grep/script-01.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt said by the Doctor. +grep "Doctor" dialogue.txt # The output should contain 6 lines. From c25a3a6ad20664e843e4389e3a83903b7edb91fe Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 11:06:30 +0200 Subject: [PATCH 13/31] Complete grep script-02: case insensitive search --- individual-shell-tools/grep/script-02.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/grep/script-02.sh b/individual-shell-tools/grep/script-02.sh index df6f85640..2ef7df6d3 100755 --- a/individual-shell-tools/grep/script-02.sh +++ b/individual-shell-tools/grep/script-02.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that contains the word Doctor (regardless of case). +grep -i "doctor" dialogue.txt # The output should contain 9 lines. From 6d9497029d4ef43d9fcdb4c01d78f8a1afc2436f Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 11:12:46 +0200 Subject: [PATCH 14/31] Complete grep script-03: count matching lines --- individual-shell-tools/grep/script-03.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/grep/script-03.sh b/individual-shell-tools/grep/script-03.sh index 5383fe578..26c29acb0 100755 --- a/individual-shell-tools/grep/script-03.sh +++ b/individual-shell-tools/grep/script-03.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output the number of lines in dialogue.txt that contain the word Doctor (regardless of case). +grep -i "doctor" dialogue.txt | wc -l # The output should be exactly the number 9. From 18343284e56f91c2f81f1924380d5c0fbaa28493 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 11:15:49 +0200 Subject: [PATCH 15/31] Complete grep script-04: exclude hello lines --- individual-shell-tools/grep/script-04.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/grep/script-04.sh b/individual-shell-tools/grep/script-04.sh index 80ee04776..4cdf1450b 100755 --- a/individual-shell-tools/grep/script-04.sh +++ b/individual-shell-tools/grep/script-04.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that does not contain the word "Hello" (regardless of case). +grep -vi "hello" dialogue.txt # The output should contain 10 lines. From d83623dc5aef4e401b28116638ae0dfec77a48f2 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 11:23:36 +0200 Subject: [PATCH 16/31] Complete grep script-05: show matching lines with previous line --- individual-shell-tools/grep/script-05.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/grep/script-05.sh b/individual-shell-tools/grep/script-05.sh index 1eb538185..126a770fd 100755 --- a/individual-shell-tools/grep/script-05.sh +++ b/individual-shell-tools/grep/script-05.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that contains the string "cure", as well as the line before that line. +grep -B 1 "cure" dialogue.txt # The output should contain two pairs of two lines of text (with a separator between them). From f2979c6a1ad04f8a720b7d255fbce897cddeb165 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 11:32:14 +0200 Subject: [PATCH 17/31] Complete grep script-06: list files containing Doctor dialogue --- individual-shell-tools/grep/script-06.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/grep/script-06.sh b/individual-shell-tools/grep/script-06.sh index 5670e3b6c..b242c530d 100755 --- a/individual-shell-tools/grep/script-06.sh +++ b/individual-shell-tools/grep/script-06.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output the name of every `.txt` file in this directory which contains a line of dialogue said by the Doctor. +grep -l "^Doctor:" *.txt # The output should contain two filenames. From cfc4ec6d2248cd5b62e3fbb001d628d0ada57626 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 11:35:23 +0200 Subject: [PATCH 18/31] Complete grep script-07: count Doctor lines per file --- individual-shell-tools/grep/script-07.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/grep/script-07.sh b/individual-shell-tools/grep/script-07.sh index 9670ebad9..9a344503f 100755 --- a/individual-shell-tools/grep/script-07.sh +++ b/individual-shell-tools/grep/script-07.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output, for each `.txt` file in this directory, how many lines of dialogue the Doctor has. +grep -c "^Doctor:" dialogue.txt # The output should show that dialogue.txt contains 6 lines, dialogue-2.txt contains 2, and dialogue-3.txt contains 0. From 40180ada75bd2c03a42a1873e0f4b24b78c25951 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 12:27:55 +0200 Subject: [PATCH 19/31] Complete sed script-01: replace i with I globally --- individual-shell-tools/sed/script-01.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/sed/script-01.sh b/individual-shell-tools/sed/script-01.sh index d592970fc..ad0620903 100755 --- a/individual-shell-tools/sed/script-01.sh +++ b/individual-shell-tools/sed/script-01.sh @@ -3,5 +3,6 @@ set -euo pipefail # TODO: Write a command to output input.txt with all occurrences of the letter `i` replaced with `I`. +sed 's/i/I/g' input.txt # The output should contain 11 lines. # The first line of the output should be: "ThIs Is a sample fIle for experImentIng wIth sed.". From b2a6c2ded9560f87e56ac75192d0203e5154994d Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 12:37:29 +0200 Subject: [PATCH 20/31] Complete sed script-02: remove digits from input --- individual-shell-tools/sed/script-02.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/sed/script-02.sh b/individual-shell-tools/sed/script-02.sh index abdd64d06..e7ec3f486 100755 --- a/individual-shell-tools/sed/script-02.sh +++ b/individual-shell-tools/sed/script-02.sh @@ -3,5 +3,6 @@ set -euo pipefail # TODO: Write a command to output input.txt with numbers removed. +sed 's/[0-9]//g' input.txt # The output should contain 11 lines. # Line 6 of the output should be " Alisha". From 0829c02976cea1bda3867b731ce8ba394f312318 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 12:42:13 +0200 Subject: [PATCH 21/31] Complete sed script-03: remove lines containing digits --- individual-shell-tools/sed/script-03.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/sed/script-03.sh b/individual-shell-tools/sed/script-03.sh index dd284a296..4be42f03b 100755 --- a/individual-shell-tools/sed/script-03.sh +++ b/individual-shell-tools/sed/script-03.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output input.txt removing any line which contains a number. +sed '/[0-9]/d' input.txt # The output should contain 6 lines. From ba97190c2250700dd4e7adc8de4e0908cd39371a Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 12:49:12 +0200 Subject: [PATCH 22/31] Complete sed script-04: replace We'll with We will --- individual-shell-tools/sed/script-04.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/sed/script-04.sh b/individual-shell-tools/sed/script-04.sh index 0052ac6c4..fcac5ae0d 100755 --- a/individual-shell-tools/sed/script-04.sh +++ b/individual-shell-tools/sed/script-04.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output input.txt replacing every occurrence of the string "We'll" with "We will". +sed "s/We'll/We will/g" input.txt # The output should contain 11 lines. From d61937056be0fa29268ecfaee4e340d2fcd01ddb Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 12:54:10 +0200 Subject: [PATCH 23/31] Complete sed script-05: reorder number and text using capture groups --- individual-shell-tools/sed/script-05.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/sed/script-05.sh b/individual-shell-tools/sed/script-05.sh index 2dcc91a0c..cd110396c 100755 --- a/individual-shell-tools/sed/script-05.sh +++ b/individual-shell-tools/sed/script-05.sh @@ -3,6 +3,7 @@ set -euo pipefail # TODO: Write a command to output input.txt with one change: +sed -E 's/^([0-9]+) (.*)$/\2 \1/' input.txt # If a line starts with a number and a space, make the line instead end with a space and the number. # So line 6 which currently reads "37 Alisha" should instead read "Alisha 37". # The output should contain 11 lines. From b970c4868841fc9eef340639cdf2d2728b9faa8a Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 13:00:34 +0200 Subject: [PATCH 24/31] Complete sed script-06: fix missing spaces after commas --- individual-shell-tools/sed/script-06.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/sed/script-06.sh b/individual-shell-tools/sed/script-06.sh index 0b9390170..3f4a6697b 100755 --- a/individual-shell-tools/sed/script-06.sh +++ b/individual-shell-tools/sed/script-06.sh @@ -3,6 +3,7 @@ set -euo pipefail # TODO: Write a command to output input.txt with one fix: +sed 's/,\([^ ]\)/, \1/g' input.txt # If a comma in input.txt is not followed by a space, add a space after. # If there is already a space after a comma, do not add an additional space. # The output should contain 11 lines. From fa91bbfc9e9efdb121173ddd998529d0b2ec3b4b Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 13:05:36 +0200 Subject: [PATCH 25/31] print names column --- individual-shell-tools/awk/script-01.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/awk/script-01.sh b/individual-shell-tools/awk/script-01.sh index 8db4390af..e33ee9a5d 100755 --- a/individual-shell-tools/awk/script-01.sh +++ b/individual-shell-tools/awk/script-01.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output just the names of each player in `scores-table.txt`. +awk '{print $1}' scores-table.txt # Your output should contain 6 lines, each with just one word on it. From 0a38d35963a2b1d2e57305e89af54fcdf40f4e9b Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 13:20:33 +0200 Subject: [PATCH 26/31] Print correct columns (name and city) --- individual-shell-tools/awk/script-02.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/awk/script-02.sh b/individual-shell-tools/awk/script-02.sh index 5956be9bd..a71a90314 100755 --- a/individual-shell-tools/awk/script-02.sh +++ b/individual-shell-tools/awk/script-02.sh @@ -3,4 +3,5 @@ set -euo pipefail # TODO: Write a command to output the names of each player, as well as their city. +awk '{print $1, $2}' scores-table.txt # Your output should contain 6 lines, each with two words on it, separated by a space. From 5f21131917b11ef638af4b7763c0b729c58e1754 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 13:26:45 +0200 Subject: [PATCH 27/31] fix name and first attempt score --- individual-shell-tools/awk/script-03.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/awk/script-03.sh b/individual-shell-tools/awk/script-03.sh index af7c6e8b9..291e35ae9 100755 --- a/individual-shell-tools/awk/script-03.sh +++ b/individual-shell-tools/awk/script-03.sh @@ -3,5 +3,6 @@ set -euo pipefail # TODO: Write a command to output just the names of each player along with the score from their first attempt. +awk '{print $1, $3}' scores-table.txt # Your output should contain 6 lines, each with one word and one number on it. # The first line should be "Ahmed 1". From e535a3f63e1ea42b1cd34aae2f971bc57968ffbd Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 13:34:01 +0200 Subject: [PATCH 28/31] Fix filter London players and print last score --- individual-shell-tools/awk/script-04.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/awk/script-04.sh b/individual-shell-tools/awk/script-04.sh index bf15703c7..fa77c70c1 100755 --- a/individual-shell-tools/awk/script-04.sh +++ b/individual-shell-tools/awk/script-04.sh @@ -3,5 +3,6 @@ set -euo pipefail # TODO: Write a command to output just the names of each player in London along with the score from their last attempt. +awk '$2 == "London" {print $1, $NF}' scores-table.txt # Your output should contain 3 lines, each with one word and one number on it. # The first line should be "Ahmed 4". From 0410bb25e154bb348bfbca04a31d8162ff697dae Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 13:37:56 +0200 Subject: [PATCH 29/31] Fix count number of attempts per player --- individual-shell-tools/awk/script-05.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/awk/script-05.sh b/individual-shell-tools/awk/script-05.sh index d1680cb02..0c95f7306 100755 --- a/individual-shell-tools/awk/script-05.sh +++ b/individual-shell-tools/awk/script-05.sh @@ -3,5 +3,6 @@ set -euo pipefail # TODO: Write a command to output just the names of each player along with the number of times they've played the game. +awk '{print $1, NF-2}' scores-table.txt # Your output should contain 6 lines, each with one word and one number on it. # The first line should be "Ahmed 3". From 1e623c9b1057b6a608dd4aff78e41daa127d5be7 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 13:45:17 +0200 Subject: [PATCH 30/31] fix sum all first scores --- individual-shell-tools/awk/script-06-stretch.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/awk/script-06-stretch.sh b/individual-shell-tools/awk/script-06-stretch.sh index 0201e6378..d42f309b9 100755 --- a/individual-shell-tools/awk/script-06-stretch.sh +++ b/individual-shell-tools/awk/script-06-stretch.sh @@ -5,4 +5,5 @@ set -euo pipefail # NOTE: This is a stretch exercise - it is optional. # TODO: Write a command to output the total of adding together all players' first scores. +awk '{sum += $3} END {print sum}' scores-table.txt # Your output should be exactly the number 54. From fc0bcc3d1bff2c3db8b74ab2c3cf765c00fd4088 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 13:53:38 +0200 Subject: [PATCH 31/31] sum all scores per player --- individual-shell-tools/awk/script-07-stretch.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/individual-shell-tools/awk/script-07-stretch.sh b/individual-shell-tools/awk/script-07-stretch.sh index 3f7155880..e298142b7 100755 --- a/individual-shell-tools/awk/script-07-stretch.sh +++ b/individual-shell-tools/awk/script-07-stretch.sh @@ -5,5 +5,12 @@ set -euo pipefail # NOTE: This is a stretch exercise - it is optional. # TODO: Write a command to output just the names of each player along with the total of adding all of that player's scores. +awk '{ + sum = 0 + for (i = 3; i <= NF; i++) { + sum += $i + } + print $1, sum +}' scores-table.txt # Your output should contain 6 lines, each with one word and one number on it. # The first line should be "Ahmed 15". The second line should be "Basia 37"