From baf58a0067b7b51d92eca526a6220d3fd70f3889 Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 19:06:28 +0100 Subject: [PATCH 01/13] Complete ls-grep script-01.sh exercise --- shell-pipelines/ls-grep/script-01.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/ls-grep/script-01.sh b/shell-pipelines/ls-grep/script-01.sh index 8c7d968a2..ef018fc46 100755 --- a/shell-pipelines/ls-grep/script-01.sh +++ b/shell-pipelines/ls-grep/script-01.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output the names of the files in the sample-files directory whose name contains at least one upper case letter. # Your output should contain 11 files. + +ls -1 sample-files | grep '[A-Z]' \ No newline at end of file From f479137e2f80301e1585603a9214baafe8f59dad Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 19:08:48 +0100 Subject: [PATCH 02/13] Complete ls-grep script-02.sh exercise --- shell-pipelines/ls-grep/script-02.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/ls-grep/script-02.sh b/shell-pipelines/ls-grep/script-02.sh index 16f5f71d9..6e29f2ec5 100755 --- a/shell-pipelines/ls-grep/script-02.sh +++ b/shell-pipelines/ls-grep/script-02.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output the names of the files in the sample-files directory whose name starts with an upper case letter. # Your output should contain 10 files. + +ls -1 sample-files | grep '^[A-Z]' \ No newline at end of file From ae4b404ba3ccd88cfe9c2458116c462e3970ffab Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 19:11:03 +0100 Subject: [PATCH 03/13] Complete ls-grep script-03.sh exercise --- shell-pipelines/ls-grep/script-03.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/ls-grep/script-03.sh b/shell-pipelines/ls-grep/script-03.sh index a302ab036..2373c741f 100755 --- a/shell-pipelines/ls-grep/script-03.sh +++ b/shell-pipelines/ls-grep/script-03.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output the names of the files in the sample-files directory whose name starts with an upper case letter and doesn't contain any other upper case letters. # Your output should contain 7 files. + +ls -1 sample-files | grep '^[A-Z][^A-Z]*$' \ No newline at end of file From 61d352f34ec99ce2df4fb37b6e80df733f75582d Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 19:12:46 +0100 Subject: [PATCH 04/13] Complete ls-grep script-04.sh exercise --- shell-pipelines/ls-grep/script-04.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/ls-grep/script-04.sh b/shell-pipelines/ls-grep/script-04.sh index c000b7e3b..da94540f9 100755 --- a/shell-pipelines/ls-grep/script-04.sh +++ b/shell-pipelines/ls-grep/script-04.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to count the number of files in the sample-files directory whose name starts with an upper case letter and doesn't contain any other upper case letters. # Your output should be the number 7. + +s-grep % ls -1 sample-files | grep '^[A-Z][^A-Z]*$' | wc -l \ No newline at end of file From 40ff3356e4fcd62148f7e80cad7f10e86bc6b8af Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 19:26:49 +0100 Subject: [PATCH 05/13] Complete sort-uniq-head-tail script-01.sh exercise --- shell-pipelines/sort-uniq-head-tail/script-01.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-01.sh b/shell-pipelines/sort-uniq-head-tail/script-01.sh index 171e1f989..454bf592b 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-01.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-01.sh @@ -5,3 +5,5 @@ set -euo pipefail # The input for this script is the scores-table.txt file. # TODO: Write a command to output scores-table.txt, with lines sorted by the person's name. # The first line of your output should be "Ahmed London 1 10 4" (with no quotes). And the third line should be "Chandra Birmingham 12 6". + +sort scores-table.txt \ No newline at end of file From 1d4dc9596e1d9ae1c9c12b442c9f48ca18cf1098 Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 19:47:00 +0100 Subject: [PATCH 06/13] Complete sort-uniq-head-tail script-02.sh exercise --- shell-pipelines/sort-uniq-head-tail/script-02.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-02.sh b/shell-pipelines/sort-uniq-head-tail/script-02.sh index 29c3c2524..94d3d498b 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-02.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-02.sh @@ -5,3 +5,5 @@ set -euo pipefail # The input for this script is the scores-table.txt file. # TODO: Write a command to output scores-table.txt, with lines sorted by the person's first score, descending. # The first line of your output should be "Basia London 22 9 6" (with no quotes). + +sort -k2 -nr scores-table.txt \ No newline at end of file From 287b4b0e005a2cc057b5f0eca0e4993ecb18fc12 Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 21:11:49 +0100 Subject: [PATCH 07/13] Complete sort-uniq-head-tail script-03.sh exercise --- shell-pipelines/sort-uniq-head-tail/script-03.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-03.sh b/shell-pipelines/sort-uniq-head-tail/script-03.sh index bcbaf3420..8475aaa35 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-03.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-03.sh @@ -8,3 +8,5 @@ set -euo pipefail # Basia London 22 9 6 # Piotr Glasgow 15 2 25 11 8 # Chandra Birmingham 12 6 + +sort -k3 -nr scores-table.txt | head -n 3 \ No newline at end of file From d652ac1af00fdb078467d921bb9d93b29b95ed4a Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 21:20:05 +0100 Subject: [PATCH 08/13] Complete sort-uniq-head-tail script-04.sh exercise --- shell-pipelines/sort-uniq-head-tail/script-04.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-04.sh b/shell-pipelines/sort-uniq-head-tail/script-04.sh index 65a5cfba8..be3b61717 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-04.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-04.sh @@ -5,3 +5,5 @@ set -euo pipefail # The input for this script is the scores-table.txt file. # TODO: Write a command to output scores-table.txt, with shows the line for the player whose first score was the second highest. # Your output should be: "Piotr Glasgow 15 2 25 11 8" (without quotes). + +sort -k3 -nr scores-table.txt | head -n 2 | tail -n 1 \ No newline at end of file From cee742e3030f44d4be09b060ce84c6b38f6f6387 Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 21:24:45 +0100 Subject: [PATCH 09/13] Complete sort-uniq-head-tail script-05.sh exercise --- shell-pipelines/sort-uniq-head-tail/script-05.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-05.sh b/shell-pipelines/sort-uniq-head-tail/script-05.sh index a93cd9f9d..1f0dc4d89 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-05.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-05.sh @@ -6,3 +6,5 @@ set -euo pipefail # TODO: Write a command to show a list of all events that have happened, without duplication. # The order they're displayed doesn't matter, but we never want to see the same event listed twice. # Your output should contain 6 lines. + +sort events.txt | uniq \ No newline at end of file From ccb55b7c25c731bb37d3a5bcb05aca1e62b66d3a Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 21:28:36 +0100 Subject: [PATCH 10/13] Complete sort-uniq-head-tail script-06.sh exercise --- shell-pipelines/sort-uniq-head-tail/script-06.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-06.sh b/shell-pipelines/sort-uniq-head-tail/script-06.sh index 715c7ae5c..aadbabff7 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-06.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-06.sh @@ -5,3 +5,5 @@ set -euo pipefail # The input for this script is the events.txt file. # TODO: Write a command to show how many times anyone has entered and exited. # It should be clear from your script's output that there have been 5 Entry events and 4 Exit events. + +grep -oE 'Entry|Exit' events.txt | sort | uniq -c \ No newline at end of file From fb0e0001cefb58fd76d4ee5106f0845bea2bfc43 Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 21:32:22 +0100 Subject: [PATCH 11/13] Complete sort-uniq-head-tail script-07.sh exercise --- shell-pipelines/sort-uniq-head-tail/script-07.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-07.sh b/shell-pipelines/sort-uniq-head-tail/script-07.sh index 7fd07e1ff..f962293d3 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-07.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-07.sh @@ -6,3 +6,5 @@ set -euo pipefail # TODO: Write a command to show how many times anyone has entered and exited. # It should be clear from your script's output that there have been 5 Entry events and 4 Exit events. # The word "Event" should not appear in your script's output. + + grep -oE 'Entry|Exit' events-with-timestamps.txt | sort | uniq -c \ No newline at end of file From a619cc657c86e2748261223f45a532eb2eefc1c7 Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 21:36:36 +0100 Subject: [PATCH 12/13] Complete tr script-01.sh exercise --- shell-pipelines/tr/script-01.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/tr/script-01.sh b/shell-pipelines/tr/script-01.sh index 8bb0211e9..d88b9094d 100755 --- a/shell-pipelines/tr/script-01.sh +++ b/shell-pipelines/tr/script-01.sh @@ -6,3 +6,5 @@ set -euo pipefail # The author got feedback that they're using too many exclamation marks (!). # # TODO: Write a command to output the contents of text.txt with every exclamation mark (!) replaced with a full-stop (.). + +cat text.txt | tr ! . \ No newline at end of file From 89f252d3ec12b30ffe5f20853bf4f41b2b627bf5 Mon Sep 17 00:00:00 2001 From: Ammad Date: Wed, 8 Apr 2026 21:41:38 +0100 Subject: [PATCH 13/13] Complete tr script-02.sh exercise --- shell-pipelines/tr/script-02.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-pipelines/tr/script-02.sh b/shell-pipelines/tr/script-02.sh index cf3a503a2..1de420eee 100755 --- a/shell-pipelines/tr/script-02.sh +++ b/shell-pipelines/tr/script-02.sh @@ -7,3 +7,5 @@ set -euo pipefail # so every Y should be a Z, and every Z should be a Y! # # TODO: Write a command to output the contents of text.txt with every Y and Z swapped (both upper and lower case). + +cat text.txt | tr 'YyZz' 'ZzYy' \ No newline at end of file