From f1e23c68b680ca7716f0a39be0df814539e759a6 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 09:42:54 +0000 Subject: [PATCH 01/32] added ls tool and tested it via bash --- 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..c9cd189b5 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 From 24c2644aa6bd21150c16b94f95ff56fdb83d5070 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 09:52:48 +0000 Subject: [PATCH 02/32] list all files inside "child-directory" folder and test --- 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..42c04fe21 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" From fcc408304d5c123a3ad0002817f7ed2e790a920c Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 10:00:35 +0000 Subject: [PATCH 03/32] Recursively list all file and folders inside "ls" folder. Then test. --- 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 cac0060acf4c3f520e7e355a413f6882c17846d9 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 10:14:46 +0000 Subject: [PATCH 04/32] modified solution --- individual-shell-tools/ls/script-04.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/individual-shell-tools/ls/script-04.sh b/individual-shell-tools/ls/script-04.sh index 72f3817b3..c35823729 100755 --- a/individual-shell-tools/ls/script-04.sh +++ b/individual-shell-tools/ls/script-04.sh @@ -15,9 +15,10 @@ 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 "child-directory" 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 "child-directory" \ No newline at end of file From f6b7696b1973ef1a11c4470deb693a24c54dc1ab Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 10:36:44 +0000 Subject: [PATCH 05/32] display the content of helper-1.txt file and test it --- 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 9e1bd4ea893150e306a5c259d152fa37e489316d Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 10:40:48 +0000 Subject: [PATCH 06/32] display content of all files inside the helper-files folder --- 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..acf515e23 100755 --- a/individual-shell-tools/cat/script-02.sh +++ b/individual-shell-tools/cat/script-02.sh @@ -11,3 +11,4 @@ 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/*.txt From 83b4ee5709e3cb3474b4ec44887dadaed556aeab Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 10:43:35 +0000 Subject: [PATCH 07/32] print the content inside 'helper-3' file where each line is numbered --- 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..dd6b1d8b1 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 From be276323978a41e905a388f9cd8c1381c66f7f72 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 11:01:03 +0000 Subject: [PATCH 08/32] display all content,numbered without resetting at the start of each file's content --- 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..698af1a8c 100755 --- a/individual-shell-tools/cat/script-04-stretch.sh +++ b/individual-shell-tools/cat/script-04-stretch.sh @@ -13,3 +13,4 @@ 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/*.txt | cat -n \ No newline at end of file From 4a19420d8712a0cc8f7d28d1aaf7ba5c49efb627 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 12:53:44 +0000 Subject: [PATCH 09/32] output the number of words in "helper-3" file --- 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..c944eeafe 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 From a299f585d249605e23dbae007478b1735a372f8a Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 12:56:05 +0000 Subject: [PATCH 10/32] output the number of lines in "helper-3.txt" file using wc --- 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..5520379b9 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 1369586f1f74f5736ea18028c4b05b50630693fe Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 12:59:10 +0000 Subject: [PATCH 11/32] output the number of lines, words & characters in all files insde "helper-files" directory --- 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..0f4d13e7d 100755 --- a/individual-shell-tools/wc/script-03.sh +++ b/individual-shell-tools/wc/script-03.sh @@ -8,3 +8,4 @@ set -euo pipefail # 1 7 39 ../helper-files/helper-2.txt # 3 19 92 ../helper-files/helper-3.txt # 5 30 151 total +wc -lwm ../helper-files/*.txt From 10c6a0ab8f57b478702b0ff32955f776c6cbc180 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 13:14:10 +0000 Subject: [PATCH 12/32] output lines starting with "Doctor" --- 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..1bd23930d 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 From 674dbea9f5576e03cedbe67190cdb482d7068b2f Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 13:16:34 +0000 Subject: [PATCH 13/32] output all lines contaning "Doctor" regardless of the case from "dialogue.txt" file --- 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..5ba3119d8 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 63aa039112d0a7b19f95eae556fcb6cd32fe87c2 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 13:21:51 +0000 Subject: [PATCH 14/32] output the number of lines in file "dialogue.txt" that contains "Doctor" regardless of the case --- 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..fc200ac18 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 -ci "Doctor" dialogue.txt From 6809ece96a37f755455c776f3d62a2d631d41dd4 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 13:25:31 +0000 Subject: [PATCH 15/32] output all lines that don't contain "Doctor" regardless of the case. --- 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..392ff8d8f 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 \ No newline at end of file From 606d1e39530bf6294f4903b196444aafb7e18656 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 13:30:59 +0000 Subject: [PATCH 16/32] output all lines containing "cure" and ouput a line before each matching 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..a7e28a473 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 863416573c02d40595f78fad71628fcca837ca53 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 13:34:41 +0000 Subject: [PATCH 17/32] print all files names containing lines of dialoge said by the Doctor --- 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..f333fc0d0 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 -l "^Doctor" *.txt \ No newline at end of file From fdd8d30e4d64eb1761104933423d4c7866f3498b Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 13:41:37 +0000 Subject: [PATCH 18/32] list the number of lines in each .txt files tht has a lines said by the Doctor --- 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..f6dcc3d05 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 "^Doctor" *.txt -c \ No newline at end of file From 51205e9eb50f9badd0589ff582a6e0615a594d4f Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 16:32:50 +0000 Subject: [PATCH 19/32] output file with all occurances of "i" replaced with "I" --- 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 3eba6fa4d..bfa952ebf 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 75b2d1892acc1371a0d39344a35abdb2cfa13b5a Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 16:45:08 +0000 Subject: [PATCH 20/32] output file while removing numbers --- 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..3819c16eb 100755 --- a/individual-shell-tools/sed/script-02.sh +++ b/individual-shell-tools/sed/script-02.sh @@ -5,3 +5,4 @@ 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". +sed "s/[0-9]//g" input.txt \ No newline at end of file From cd1a10bfd1c2af10537c0b02186c58b5b5e59f0b Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 16:48:55 +0000 Subject: [PATCH 21/32] remove all lines with a number on them from the file --- 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..87db74dc3 100755 --- a/individual-shell-tools/sed/script-03.sh +++ b/individual-shell-tools/sed/script-03.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output input.txt removing any line which contains a number. # The output should contain 6 lines. +sed "/[0-9]/d" input.txt \ No newline at end of file From 0449dd71806904a2ba1ada87f0a8ef5350b69d4c Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 16:57:24 +0000 Subject: [PATCH 22/32] replace an expression with another in a file --- 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..478211422 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 \ No newline at end of file From e88deccc25ce852ae13995130a7ba3981f54b5cd Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 17:35:57 +0000 Subject: [PATCH 23/32] make lines start with a number followed by space replaced with a space and a number at the end of each line --- individual-shell-tools/sed/script-05.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/individual-shell-tools/sed/script-05.sh b/individual-shell-tools/sed/script-05.sh index 2dcc91a0c..b81b97565 100755 --- a/individual-shell-tools/sed/script-05.sh +++ b/individual-shell-tools/sed/script-05.sh @@ -6,3 +6,5 @@ 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. +sed -E "s/^[[:space:]]*([0-9]+)[[:space:]]+(.*)$/\2 \1/" input.txt + From b44846660e2f741b91cf4ea03413597f4c4c725e Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 19:57:54 +0000 Subject: [PATCH 24/32] need sowrking on --- 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..c342136cb 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 \ No newline at end of file From f06a678e1c8197def37456798020ac339aa679b8 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 20:03:43 +0000 Subject: [PATCH 25/32] output the names column from the file --- 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..824e4c58b 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 9c1dff5ea2cda7e20c25a2e52b8dca1cfa19150b Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 20:14:32 +0000 Subject: [PATCH 26/32] print the player column along with its respective city column and a space in between --- 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..1c8de9d5d 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 -F' ' '{print $1, $2}' scores-table.txt \ No newline at end of file From f02095d0f2afb0c9e8f200469a0d80ca33da4cf1 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 20:16:43 +0000 Subject: [PATCH 27/32] print the player column along with its respective first attempt column --- 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..b67afd0c3 100755 --- a/individual-shell-tools/awk/script-03.sh +++ b/individual-shell-tools/awk/script-03.sh @@ -5,3 +5,4 @@ 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 -F' ' '{print $1, $3}' scores-table.txt \ No newline at end of file From 9a693742d80b3f2694b966b05af23f9392119138 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 20:25:29 +0000 Subject: [PATCH 28/32] display players column along with their respective last score attempt column --- 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..eca49a376 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 -F' ' '/London/{print $1, $NF}' scores-table.txt \ No newline at end of file From b79b2a4f4f3f180ccf070e012bc4884c57ecf913 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 20:33:13 +0000 Subject: [PATCH 29/32] display each play name along with the number of times they've played the game --- 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..418812867 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 -F' ' '{print $1, NF-2}' scores-table.txt \ No newline at end of file From 89e879b077cf5a9ba6bfea2039deb0b523934c0c Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Sun, 9 Nov 2025 20:38:44 +0000 Subject: [PATCH 30/32] display the sum of the first score attempt for all players --- 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..6a268bbeb 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 25db0ac67040e03bf91cedf3d7f63685f477f660 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Fri, 28 Nov 2025 19:41:14 +0000 Subject: [PATCH 31/32] simplify solution for script-02.sh --- individual-shell-tools/awk/script-02.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/individual-shell-tools/awk/script-02.sh b/individual-shell-tools/awk/script-02.sh index 1c8de9d5d..5559ca2fb 100755 --- a/individual-shell-tools/awk/script-02.sh +++ b/individual-shell-tools/awk/script-02.sh @@ -4,4 +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 -F' ' '{print $1, $2}' scores-table.txt \ No newline at end of file +awk '{print $1, $2}' scores-table.txt \ No newline at end of file From 19e1227dbdb49a85c1bb8811a3c9dbd10a971d40 Mon Sep 17 00:00:00 2001 From: HassanOHOsman Date: Fri, 28 Nov 2025 19:58:04 +0000 Subject: [PATCH 32/32] simplified code since we have one space per line --- individual-shell-tools/sed/script-05.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/individual-shell-tools/sed/script-05.sh b/individual-shell-tools/sed/script-05.sh index b81b97565..b9521c8e1 100755 --- a/individual-shell-tools/sed/script-05.sh +++ b/individual-shell-tools/sed/script-05.sh @@ -6,5 +6,5 @@ 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. -sed -E "s/^[[:space:]]*([0-9]+)[[:space:]]+(.*)$/\2 \1/" input.txt +sed -E "s/^([0-9]+) (.*)$/\2 \1/" input.txt