London | 26-SDC-Mar | Mariia Serhiienko | Sprint 1 | Individual shell tools#421
Open
Konvaly wants to merge 6 commits intoCodeYourFuture:mainfrom
Open
London | 26-SDC-Mar | Mariia Serhiienko | Sprint 1 | Individual shell tools#421Konvaly wants to merge 6 commits intoCodeYourFuture:mainfrom
Konvaly wants to merge 6 commits intoCodeYourFuture:mainfrom
Conversation
SlideGauge
reviewed
Apr 17, 2026
SlideGauge
left a comment
There was a problem hiding this comment.
Could you address my notes please?
| # NOTE: This is a stretch exercise - it is optional. | ||
|
|
||
| # TODO: Write a command to output the contents of all of the files in the helper-files directory to the terminal. | ||
| cat -n helper-files/* |
There was a problem hiding this comment.
Will this approach avoid resetting of line numbers at the start of each file?
| set -euo pipefail | ||
|
|
||
| # TODO: Write a command to output every line in dialogue.txt that contains the word Doctor (regardless of case). | ||
| grep -iw 'doctor' dialogue.txt |
There was a problem hiding this comment.
Will this pattern accept lines like "Doctor:"?
| set -euo pipefail | ||
|
|
||
| # TODO: Write a command to output the number of lines in dialogue.txt that contain the word Doctor (regardless of case). | ||
| grep -iw 'doctor' dialogue.txt | wc -l |
There was a problem hiding this comment.
Will this pattern accept lines like "Doctor:"?
| set -euo pipefail | ||
|
|
||
| # TODO: Write a command to output, for each `.txt` file in this directory, how many lines of dialogue the Doctor has. | ||
| grep -c '^Doctor:' dialogue.txt dialogue-2.txt dialogue-3.txt |
There was a problem hiding this comment.
Do we need to hardcode all the file names if the task asks to output for each file in the directory?
| 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. | ||
| ls -lt child-directory |
There was a problem hiding this comment.
will this approach give us filenames only?
| # 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 |
| # 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 '$2 == "London" { print $1, $NF }' scores-table.txt No newline at end of file |
|
|
||
| # 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 |
| # 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 |
| # 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 '$2 == "London" { print $1, $NF }' scores-table.txt No newline at end of file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Solved task Individual shell tools