From 3ef4f03f152f1e447cd61b1c1b5d4ddadff741d4 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 13:55:10 +0100 Subject: [PATCH 01/32] awk print names --- 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..c1c5f0d9e 100755 --- a/individual-shell-tools/awk/script-01.sh +++ b/individual-shell-tools/awk/script-01.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output just the names of each player in `scores-table.txt`. # Your output should contain 6 lines, each with just one word on it. +awk '{print $1}' ./scores-table.txt \ No newline at end of file From 0af066260129ff32781182c38dddd3430e710074 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 14:26:14 +0100 Subject: [PATCH 02/32] awk 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..7bed6efa2 100755 --- a/individual-shell-tools/awk/script-02.sh +++ b/individual-shell-tools/awk/script-02.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output the names of each player, as well as their city. # Your output should contain 6 lines, each with two words on it, separated by a space. +awk '{print $1 " " $2}' ./scores-table.txt From c8a87cabf7041d0e39715d9cb254f83df2e66e60 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 14:35:31 +0100 Subject: [PATCH 03/32] awk name and first attempt --- individual-shell-tools/awk/script-03.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/individual-shell-tools/awk/script-03.sh b/individual-shell-tools/awk/script-03.sh index af7c6e8b9..3a171f34b 100755 --- a/individual-shell-tools/awk/script-03.sh +++ b/individual-shell-tools/awk/script-03.sh @@ -5,3 +5,5 @@ 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". + +awk '{print $1 " " $3}' ./scores-table.txt \ No newline at end of file From cd57b30b6d9a43c9c9701263aee13e8ff8d86a33 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 14:38:16 +0100 Subject: [PATCH 04/32] London name and 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..d3749cb3c 100755 --- a/individual-shell-tools/awk/script-04.sh +++ b/individual-shell-tools/awk/script-04.sh @@ -5,3 +5,4 @@ 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. # Your output should contain 3 lines, each with one word and one number on it. # The first line should be "Ahmed 4". +awk '{if ($2 == "London"){print $1 " " $NF}}' ./scores-table.txt \ No newline at end of file From 1e48799b93ad384000d13b8bde18de26f531f531 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 14:44:27 +0100 Subject: [PATCH 05/32] count of attempts --- 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..626eec7c2 100755 --- a/individual-shell-tools/awk/script-05.sh +++ b/individual-shell-tools/awk/script-05.sh @@ -5,3 +5,4 @@ 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. # Your output should contain 6 lines, each with one word and one number on it. # The first line should be "Ahmed 3". +awk '{print $1 " " NF - 2}' ./scores-table.txt \ No newline at end of file From 265d524066eccc245feae1cb661740fe93a9fbc5 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 14:55:22 +0100 Subject: [PATCH 06/32] awk sum --- 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..b89efe1f1 100755 --- a/individual-shell-tools/awk/script-06-stretch.sh +++ b/individual-shell-tools/awk/script-06-stretch.sh @@ -6,3 +6,4 @@ set -euo pipefail # TODO: Write a command to output the total of adding together all players' first scores. # Your output should be exactly the number 54. +awk '{sum += $3}; END {print sum}' ./scores-table.txt \ No newline at end of file From c6d0f85f8fdfadd063e18a442317a03f410ee700 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 15:07:30 +0100 Subject: [PATCH 07/32] awk sum of attempts --- individual-shell-tools/awk/script-07-stretch.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/individual-shell-tools/awk/script-07-stretch.sh b/individual-shell-tools/awk/script-07-stretch.sh index 3f7155880..daef14c04 100755 --- a/individual-shell-tools/awk/script-07-stretch.sh +++ b/individual-shell-tools/awk/script-07-stretch.sh @@ -7,3 +7,6 @@ set -euo pipefail # TODO: Write a command to output just the names of each player along with the total of adding all of that player's scores. # 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" +awk '{sum=0; for (i = 3; i <= NF; i++) { + sum += $i +} print $1 " " sum }' ./scores-table.txt \ No newline at end of file From fddd9f068a1d9f4d412fcb08201a216e781ebda1 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 15:12:52 +0100 Subject: [PATCH 08/32] cat1 --- 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..94ceeb4fe 100755 --- a/individual-shell-tools/cat/script-01.sh +++ b/individual-shell-tools/cat/script-01.sh @@ -4,3 +4,4 @@ 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. # The output of this command should be "Once upon a time...". +cat ../helper-files/helper-1.txt \ No newline at end of file From af053ef0d73767366216e92f29c38bf7487d63a5 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 15:14:09 +0100 Subject: [PATCH 09/32] cat 2 --- individual-shell-tools/cat/script-02.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/individual-shell-tools/cat/script-02.sh b/individual-shell-tools/cat/script-02.sh index 01bbd5eab..913e2c51b 100755 --- a/individual-shell-tools/cat/script-02.sh +++ b/individual-shell-tools/cat/script-02.sh @@ -11,3 +11,5 @@ set -euo pipefail # It looked delicious. # I was tempted to take a bite of it. # But this seemed like a bad idea... + +cat ../helper-files/helper-1.txt ../helper-files/helper-2.txt ../helper-files/helper-3.txt \ No newline at end of file From debb07eb41b595a9cc6e3dc16d8625898c123e02 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 15:15:04 +0100 Subject: [PATCH 10/32] cat 3 --- 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..e4c6d99f6 100755 --- a/individual-shell-tools/cat/script-03.sh +++ b/individual-shell-tools/cat/script-03.sh @@ -9,3 +9,4 @@ set -euo pipefail # 1 It looked delicious. # 2 I was tempted to take a bite of it. # 3 But this seemed like a bad idea... +cat -n ../helper-files/helper-3.txt \ No newline at end of file From 3e262d7ace8fe44cb2326007af6c90ba1b07fcca Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 15:30:48 +0100 Subject: [PATCH 11/32] continuous line numbering --- individual-shell-tools/cat/script-04-stretch.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/individual-shell-tools/cat/script-04-stretch.sh b/individual-shell-tools/cat/script-04-stretch.sh index 00fe3c48b..39378e29f 100755 --- a/individual-shell-tools/cat/script-04-stretch.sh +++ b/individual-shell-tools/cat/script-04-stretch.sh @@ -13,3 +13,5 @@ set -euo pipefail # 3 It looked delicious. # 4 I was tempted to take a bite of it. # 5 But this seemed like a bad idea... + +cat ../helper-files/helper-1.txt ../helper-files/helper-2.txt ../helper-files/helper-3.txt | cat -n From 403632fa2057d7aed3936bf9b0c620d7d0671832 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 15:38:10 +0100 Subject: [PATCH 12/32] grep1 --- 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..c8e5a1169 100755 --- a/individual-shell-tools/grep/script-01.sh +++ b/individual-shell-tools/grep/script-01.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt said by the Doctor. # The output should contain 6 lines. +grep '^Doctor:' ./dialogue.txt \ No newline at end of file From e84f9f9c577feb71889a0e0cca3cb32731f5685d Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 15:48:00 +0100 Subject: [PATCH 13/32] grep2 --- 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..58d2687b9 100755 --- a/individual-shell-tools/grep/script-02.sh +++ b/individual-shell-tools/grep/script-02.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that contains the word Doctor (regardless of case). # The output should contain 9 lines. +grep -i 'doctor' ./dialogue.txt From b91c17653ca5e349611cab663136915d20a26717 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 15:49:15 +0100 Subject: [PATCH 14/32] grep3 --- 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..394e8d942 100755 --- a/individual-shell-tools/grep/script-03.sh +++ b/individual-shell-tools/grep/script-03.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output the number of lines in dialogue.txt that contain the word Doctor (regardless of case). # The output should be exactly the number 9. +grep -i 'doctor' ./dialogue.txt | wc -l From 596ca7543600914bda1f8897c3c36170d9be2b19 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 15:59:48 +0100 Subject: [PATCH 15/32] grep4 --- 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..384892301 100755 --- a/individual-shell-tools/grep/script-04.sh +++ b/individual-shell-tools/grep/script-04.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that does not contain the word "Hello" (regardless of case). # The output should contain 10 lines. +grep -vi 'hello' ./dialogue.txt | grep . \ No newline at end of file From b2fddf7be1782228f3ec23f89e331e489fc02eaa Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 17:39:47 +0100 Subject: [PATCH 16/32] grep5 --- 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..12a6736cd 100755 --- a/individual-shell-tools/grep/script-05.sh +++ b/individual-shell-tools/grep/script-05.sh @@ -4,3 +4,4 @@ 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. # The output should contain two pairs of two lines of text (with a separator between them). +grep -B 1 'cure' ./dialogue.txt \ No newline at end of file From 1d7d34bae962233804b58eb3740cabfe83024761 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 17:47:05 +0100 Subject: [PATCH 17/32] grep6 --- 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..fb6642945 100755 --- a/individual-shell-tools/grep/script-06.sh +++ b/individual-shell-tools/grep/script-06.sh @@ -4,3 +4,4 @@ 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. # The output should contain two filenames. +grep -Rl '^Doctor:' From b2d56fa500052863a01efb2cfd73be2bbe938f73 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 18:27:52 +0100 Subject: [PATCH 18/32] grep7 --- 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..bb8203549 100755 --- a/individual-shell-tools/grep/script-07.sh +++ b/individual-shell-tools/grep/script-07.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output, for each `.txt` file in this directory, how many lines of dialogue the Doctor has. # The output should show that dialogue.txt contains 6 lines, dialogue-2.txt contains 2, and dialogue-3.txt contains 0. +grep -c '^Doctor:' ./*txt \ No newline at end of file From c2de0099c17e61d58f7712410e13e82eec7d2d28 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 18:29:46 +0100 Subject: [PATCH 19/32] ls1 --- 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..0641b0f3f 100755 --- a/individual-shell-tools/ls/script-01.sh +++ b/individual-shell-tools/ls/script-01.sh @@ -13,3 +13,4 @@ fi # TODO: Write a command to list the files and folders in this directory. # The output should be a list of names including child-directory, script-01.sh, script-02.sh, and more. +ls \ No newline at end of file From 2699f6abcd21ec3b1600d6a5139fd1c1a0b07628 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 18:33:26 +0100 Subject: [PATCH 20/32] ls2 --- 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..6dbb2bb5b 100755 --- a/individual-shell-tools/ls/script-02.sh +++ b/individual-shell-tools/ls/script-02.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command which lists all of the files in the directory named child-directory. # The output should be a list of names: helper-1.txt, helper-2.txt, helper-3.txt. +ls ./child-directory \ No newline at end of file From d39318f37a5c7b2b3c93b3a47f3cd09f86c1be49 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 18:34:17 +0100 Subject: [PATCH 21/32] ls3 --- 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..7a1a1d315 100755 --- a/individual-shell-tools/ls/script-03.sh +++ b/individual-shell-tools/ls/script-03.sh @@ -5,3 +5,4 @@ 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. # 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. +ls -R \ No newline at end of file From 54feb3b309948d7f0a97bb297cd1a0f3d346c0b4 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Thu, 9 Jul 2026 18:48:27 +0100 Subject: [PATCH 22/32] ls4 --- 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..f75dd4651 100755 --- a/individual-shell-tools/ls/script-04.sh +++ b/individual-shell-tools/ls/script-04.sh @@ -15,9 +15,11 @@ 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. # The output should be a list of names in this order, one per line: helper-3.txt, helper-1.txt, helper-2.txt. +ls -1t 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). # The output should be a list of names in this order, one per line: helper-2.txt, helper-1.txt, helper-3.txt. +ls -1tr From 281aca708a702f1e131eb46c3bd2bb522c28859c Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 10 Jul 2026 16:32:17 +0100 Subject: [PATCH 23/32] sed1 --- 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..163b5ce5e 100755 --- a/individual-shell-tools/sed/script-01.sh +++ b/individual-shell-tools/sed/script-01.sh @@ -5,3 +5,4 @@ set -euo pipefail # TODO: Write a command to output input.txt with all occurrences of the letter `i` replaced with `I`. # The output should contain 11 lines. # The first line of the output should be: "ThIs Is a sample fIle for experImentIng wIth sed.". +sed s':i:I:g' ./input.txt \ No newline at end of file From df0e647baf9706aef41278202511fcdb974048d4 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 10 Jul 2026 16:40:33 +0100 Subject: [PATCH 24/32] sed2 --- individual-shell-tools/sed/script-02.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/individual-shell-tools/sed/script-02.sh b/individual-shell-tools/sed/script-02.sh index abdd64d06..861786bd4 100755 --- a/individual-shell-tools/sed/script-02.sh +++ b/individual-shell-tools/sed/script-02.sh @@ -5,3 +5,7 @@ set -euo pipefail # TODO: Write a command to output input.txt with numbers removed. # The output should contain 11 lines. # Line 6 of the output should be " Alisha". + +# -E is extended regex, needed for + (one or more) quantifier +# [[:space:]] is POSIX compliant +sed -E s':[0-9]+[[:space:]]::g' ./input.txt From f39a089a1b9458fb45c80668df4304db265f0d71 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 10 Jul 2026 17:12:47 +0100 Subject: [PATCH 25/32] sed3 --- individual-shell-tools/sed/script-03.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/individual-shell-tools/sed/script-03.sh b/individual-shell-tools/sed/script-03.sh index dd284a296..5bc50fccd 100755 --- a/individual-shell-tools/sed/script-03.sh +++ b/individual-shell-tools/sed/script-03.sh @@ -4,3 +4,12 @@ set -euo pipefail # TODO: Write a command to output input.txt removing any line which contains a number. # The output should contain 6 lines. + +# Should this not be done with grep? + +# -n prevent default printing behaviour +# ! negates regex match, i.e. gets lines that don't match +# p prints +sed -n ':[0-9]:!p' input.txt + + From 9a57ad03543ff134162977ebb7f715ea7148006b Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 10 Jul 2026 17:23:10 +0100 Subject: [PATCH 26/32] sed4 --- 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..7e789a1aa 100755 --- a/individual-shell-tools/sed/script-04.sh +++ b/individual-shell-tools/sed/script-04.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output input.txt replacing every occurrence of the string "We'll" with "We will". # The output should contain 11 lines. +sed s"/We'll/We will/g" ./input.txt From 6ffbf043fd7f3c71a5a0c44260fb29cd8c7314a9 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 10 Jul 2026 17:24:53 +0100 Subject: [PATCH 27/32] sed2: make delimiter clearner --- individual-shell-tools/sed/script-02.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/individual-shell-tools/sed/script-02.sh b/individual-shell-tools/sed/script-02.sh index 861786bd4..7dc3e72f4 100755 --- a/individual-shell-tools/sed/script-02.sh +++ b/individual-shell-tools/sed/script-02.sh @@ -8,4 +8,4 @@ set -euo pipefail # -E is extended regex, needed for + (one or more) quantifier # [[:space:]] is POSIX compliant -sed -E s':[0-9]+[[:space:]]::g' ./input.txt +sed -E s'/[0-9]+[[:space:]]//g' ./input.txt From b958808bf3e12841b4f4ce302ebef2169a6c94ab Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 10 Jul 2026 17:36:50 +0100 Subject: [PATCH 28/32] sed5 --- individual-shell-tools/sed/script-05.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/individual-shell-tools/sed/script-05.sh b/individual-shell-tools/sed/script-05.sh index 2dcc91a0c..4cb9d03da 100755 --- a/individual-shell-tools/sed/script-05.sh +++ b/individual-shell-tools/sed/script-05.sh @@ -6,3 +6,10 @@ set -euo pipefail # 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. + +# Use capture groups +# 1 is just numbers +# space after number is part of the pattern but not the group +# 2 is everything else +# then print out group 2, a space, and then group 1 +sed -E 's/^([0-9]+) (.*)/\2 \1/' input.txt From b6987322e621bf4bcefa48631ed639f3d04cf2a3 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 10 Jul 2026 17:43:12 +0100 Subject: [PATCH 29/32] sed6 --- 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..c5eed9037 100755 --- a/individual-shell-tools/sed/script-06.sh +++ b/individual-shell-tools/sed/script-06.sh @@ -8,3 +8,4 @@ set -euo pipefail # The output should contain 11 lines. # Line 3 should be "It contains many lines, and there are some things you may want to do with each of them.". # Line 11 should be "We also should remember, when we go shopping, to get 4 items: oranges, cheese, bread, olives.". +sed -E 's/,([^ ])/, \1/g' input.txt From be5e3924c3e2430367d931bd7fc58ab747ed9545 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 10 Jul 2026 17:44:54 +0100 Subject: [PATCH 30/32] wc1 --- 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..2b1e87d63 100755 --- a/individual-shell-tools/wc/script-01.sh +++ b/individual-shell-tools/wc/script-01.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output the number of words in the file helper-files/helper-3.txt. # The output should include the number 19. The output should not include the number 92. +wc -w ../helper-files/helper-3.txt \ No newline at end of file From 4bc9eefb1a9a1314e0d81b86969a5165d010421a Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 10 Jul 2026 17:48:28 +0100 Subject: [PATCH 31/32] wc2 --- 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..a13104a12 100755 --- a/individual-shell-tools/wc/script-02.sh +++ b/individual-shell-tools/wc/script-02.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output the number of lines in the file helper-files/helper-3.txt. # The output should include the number 3. The output should not include the number 19. +wc -l ../helper-files/helper-3.txt \ No newline at end of file From 05409ac41c30c34c194ae56d2f483eeeeeeaee16 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 10 Jul 2026 17:51:04 +0100 Subject: [PATCH 32/32] wc3 --- individual-shell-tools/wc/script-03.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/individual-shell-tools/wc/script-03.sh b/individual-shell-tools/wc/script-03.sh index 6b2e9d3d1..f85078a0d 100755 --- a/individual-shell-tools/wc/script-03.sh +++ b/individual-shell-tools/wc/script-03.sh @@ -8,3 +8,5 @@ set -euo pipefail # 1 7 39 ../helper-files/helper-2.txt # 3 19 92 ../helper-files/helper-3.txt # 5 30 151 total + +wc -lwc ../helper-files/helper-1.txt ../helper-files/helper-2.txt ../helper-files/helper-3.txt \ No newline at end of file