IHEB HAMDI | oct2025-2 | Module-Tools | Shell/pipelines - #4
Conversation
…nd their last attempt
…n the word Dcotor
…n the word Dcotor with ignoring
…regardiling the senesitive case
…contain any other upper case letter
|
|
||
| # 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". |
There was a problem hiding this comment.
Works but hardcoded and not flexible.
|
|
||
| grep "" dialogue.txt | ||
| # TODO: Write a command to output every line in dialogue.txt said by the Doctor. | ||
| # The output should contain 6 lines. |
There was a problem hiding this comment.
Matches all lines, no filtering.
|
|
||
| grep -F "Doctor" dialogue.txt | ||
| # 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. |
There was a problem hiding this comment.
Missing case-insensitive flag (-i).
| # 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' input.txt |
There was a problem hiding this comment.
Missing g , only replaces first match per line.
| # The input for this script is the person.json file. | ||
| # TODO: Write a command to output the name of the person. | ||
| jq '.name' person.json | ||
| # Your output should be exactly the string "Selma", but should not contain any quote characters. |
There was a problem hiding this comment.
Missing -r, output includes quotes.
|
|
||
| # The input for this script is the person.json file. | ||
| # TODO: Write a command to output the address of the person, all on one line, with a comma between each line. | ||
| jq -c '.address | join(", ")' person.json |
There was a problem hiding this comment.
Missing -r, output includes quotes.
| # The input for this script is the person.json file. | ||
| # TODO: Write a command to output the name of the person, then a comma, then their profession. | ||
| jq '[.name, .profession] | join(", ")' person.json | ||
| # Your output should be exactly the string "Selma, Software Engineer", but should not contain any quote characters. |
There was a problem hiding this comment.
Missing -r, output includes quotes.
| # TODO: Write a command to output just the names of each player, one per line. | ||
| jq '.[].name' scores.json | ||
| # Your output should contain 6 lines, each with just one word on it. | ||
| # Your output should not contain any quote characters. |
There was a problem hiding this comment.
Missing -r, output includes quotes.
| Convert the decimal number 14 to binary. | ||
| Answer: | ||
|
|
||
| 0001 0100 |
There was a problem hiding this comment.
Incorrect conversion (should be 1110)
|
|
||
| dark grey | ||
| If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean? | ||
| Answer: |
| # 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 --group |
There was a problem hiding this comment.
Doesn’t count occurrences (wrong tool/flags)
| # 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. | ||
| sort events.txt | uniq --group No newline at end of file |
| # 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 'Z' 'z' | tr 'Y' 'y' | tr 'z' 'Z' | tr 'y' 'Y' |
There was a problem hiding this comment.
Incorrect swap logic; transforms incorrectly
yassineyahya-occ
left a comment
There was a problem hiding this comment.
Good overall work, but watch for missing flags and choose the correct tools/filters more carefully.
good job Hamdi !
In this project, I practiced using core shell commands to process and analyze text files efficiently. Key skills learned:
lsgrepsortuniqheadandtail