From 5fec26f275ff1386a03763e94f1a1571fa87592b Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 21:53:38 +0200 Subject: [PATCH 01/13] list files with uppercase letters using grep --- shell-pipelines/ls-grep/script-01.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/ls-grep/script-01.sh b/shell-pipelines/ls-grep/script-01.sh index 8c7d968a2..b77993b26 100755 --- a/shell-pipelines/ls-grep/script-01.sh +++ b/shell-pipelines/ls-grep/script-01.sh @@ -4,3 +4,4 @@ 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 sample-files | grep '[A-Z]' From 1e504c8c7fe524ed0ec06b0670359e8e78d2ff1f Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 21:59:36 +0200 Subject: [PATCH 02/13] list files starting with uppercase letters --- shell-pipelines/ls-grep/script-02.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/ls-grep/script-02.sh b/shell-pipelines/ls-grep/script-02.sh index 16f5f71d9..90eb3f2bf 100755 --- a/shell-pipelines/ls-grep/script-02.sh +++ b/shell-pipelines/ls-grep/script-02.sh @@ -4,3 +4,4 @@ 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 sample-files | grep '^[A-Z]' \ No newline at end of file From bb9cc51e83bd70221c088aca71262659989451d7 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 22:09:41 +0200 Subject: [PATCH 03/13] list files starting with one uppercase and no other uppercase letters --- shell-pipelines/ls-grep/script-03.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/ls-grep/script-03.sh b/shell-pipelines/ls-grep/script-03.sh index a302ab036..2d85418b7 100755 --- a/shell-pipelines/ls-grep/script-03.sh +++ b/shell-pipelines/ls-grep/script-03.sh @@ -4,3 +4,4 @@ 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 sample-files | grep '^[A-Z][^A-Z]*$' \ No newline at end of file From bd8d637b1786fefa749a058fcfc223cba4964ac0 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 22:15:29 +0200 Subject: [PATCH 04/13] count files starting with single uppercase letter --- shell-pipelines/ls-grep/script-04.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/ls-grep/script-04.sh b/shell-pipelines/ls-grep/script-04.sh index c000b7e3b..8ed24de04 100755 --- a/shell-pipelines/ls-grep/script-04.sh +++ b/shell-pipelines/ls-grep/script-04.sh @@ -4,3 +4,4 @@ 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. +ls sample-files | grep '^[A-Z][^A-Z]*$' | wc -l | tr -d ' ' From 83e45348ea9ebd4db3f8773b27d7c6a81b522cb7 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 22:28:59 +0200 Subject: [PATCH 05/13] sort scores table by name --- shell-pipelines/sort-uniq-head-tail/script-01.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-01.sh b/shell-pipelines/sort-uniq-head-tail/script-01.sh index 171e1f989..845ad89da 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-01.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-01.sh @@ -5,3 +5,4 @@ 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 From 74ebdff7fb83f58cf117540cb26882ecbe050f0f Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 22:34:02 +0200 Subject: [PATCH 06/13] sort scores by first score descending --- shell-pipelines/sort-uniq-head-tail/script-02.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-02.sh b/shell-pipelines/sort-uniq-head-tail/script-02.sh index 29c3c2524..c46238f07 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-02.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-02.sh @@ -5,3 +5,4 @@ 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 -k3 -nr scores-table.txt From 92cb212af114edc0d8ebae1f203525f1fa208e2e Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 22:39:35 +0200 Subject: [PATCH 07/13] get top 3 players by first scores --- shell-pipelines/sort-uniq-head-tail/script-03.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-03.sh b/shell-pipelines/sort-uniq-head-tail/script-03.sh index bcbaf3420..fd2abf255 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-03.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-03.sh @@ -8,3 +8,4 @@ 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 From de5865ab05e6c8cb5e08e81db66e968598fc8586 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 22:45:07 +0200 Subject: [PATCH 08/13] get player with second highest first score --- shell-pipelines/sort-uniq-head-tail/script-04.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-04.sh b/shell-pipelines/sort-uniq-head-tail/script-04.sh index 65a5cfba8..b0ede00f5 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-04.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-04.sh @@ -5,3 +5,4 @@ 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 From 7e0b407cc4e1cf6f203201d1922db7d377785266 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 22:51:07 +0200 Subject: [PATCH 09/13] remove duplicate events using sort and uniq --- shell-pipelines/sort-uniq-head-tail/script-05.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-05.sh b/shell-pipelines/sort-uniq-head-tail/script-05.sh index a93cd9f9d..bdc16e1c8 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-05.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-05.sh @@ -6,3 +6,4 @@ 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 387a121750c642553fe0512542b6da8bdee2a19c Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 22:58:53 +0200 Subject: [PATCH 10/13] count entry and exit events using uniq -c --- shell-pipelines/sort-uniq-head-tail/script-06.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-06.sh b/shell-pipelines/sort-uniq-head-tail/script-06.sh index 715c7ae5c..352c7fd9b 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-06.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-06.sh @@ -5,3 +5,4 @@ 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. +sort events.txt | uniq -c From 1164b7b4fb18a4388adb5faa8cd0c84d258c0928 Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 23:07:50 +0200 Subject: [PATCH 11/13] count entry and exit events using cut, sort and uniq --- shell-pipelines/sort-uniq-head-tail/script-07.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-07.sh b/shell-pipelines/sort-uniq-head-tail/script-07.sh index 7fd07e1ff..e5e8f7f8d 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-07.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-07.sh @@ -6,3 +6,4 @@ 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. +cut -d ' ' -f3 events-with-timestamps.txt | sort | uniq -c From 2c27304a3577f35dc80e15cfbb3188a50048ed2c Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 23:18:36 +0200 Subject: [PATCH 12/13] replace exclamation marks with full stops using tr --- shell-pipelines/tr/script-01.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/tr/script-01.sh b/shell-pipelines/tr/script-01.sh index 8bb0211e9..f91ef30d3 100755 --- a/shell-pipelines/tr/script-01.sh +++ b/shell-pipelines/tr/script-01.sh @@ -6,3 +6,4 @@ 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 (.). +tr '!' '.' < text.txt From a9a244f5dc23a98b2781f19df5411f6e33f3ef9c Mon Sep 17 00:00:00 2001 From: SlimMicheals Date: Sun, 5 Apr 2026 23:23:47 +0200 Subject: [PATCH 13/13] swap Y and Z characters using tr --- shell-pipelines/tr/script-02.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell-pipelines/tr/script-02.sh b/shell-pipelines/tr/script-02.sh index cf3a503a2..a5250f788 100755 --- a/shell-pipelines/tr/script-02.sh +++ b/shell-pipelines/tr/script-02.sh @@ -7,3 +7,4 @@ 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). +tr 'YyZz' 'ZzYy' < text.txt \ No newline at end of file