Skip to content

London | 26-SDC-Mar | Mariia Serhiienko | Sprint 1 | Individual shell tools#421

Open
Konvaly wants to merge 6 commits intoCodeYourFuture:mainfrom
Konvaly:individual-shell-tools
Open

London | 26-SDC-Mar | Mariia Serhiienko | Sprint 1 | Individual shell tools#421
Konvaly wants to merge 6 commits intoCodeYourFuture:mainfrom
Konvaly:individual-shell-tools

Conversation

@Konvaly
Copy link
Copy Markdown

@Konvaly Konvaly commented Mar 24, 2026

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Solved task Individual shell tools

@Konvaly Konvaly added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 24, 2026
Copy link
Copy Markdown

@SlideGauge SlideGauge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/*
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing new line is absent

# 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing new line is absent


# 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing new line is absent

# 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing new line is absent

# 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct use of NF, like

@SlideGauge SlideGauge added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants