Skip to content

London | 26-SDC-March | Zobeir Rigi | Sprint 1 | Individual shell tools#400

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

London | 26-SDC-March | Zobeir Rigi | Sprint 1 | Individual shell tools#400
Zobeir-Rigi wants to merge 6 commits intoCodeYourFuture:mainfrom
Zobeir-Rigi:individual-shell-tools

Conversation

@Zobeir-Rigi
Copy link
Copy Markdown

@Zobeir-Rigi Zobeir-Rigi commented Mar 20, 2026

Summary

Implemented individual shell tool exercises, including ls, cat, wc, grep, sed, and awk. Practised file navigation and text processing using standard Unix commands.

Checklist

  • I have titled my PR correctly
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

@Zobeir-Rigi Zobeir-Rigi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 20, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 20, 2026
@github-actions

This comment has been minimized.

@Zobeir-Rigi Zobeir-Rigi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 20, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 20, 2026
@Zobeir-Rigi Zobeir-Rigi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 20, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 20, 2026
@github-actions

This comment has been minimized.

@Zobeir-Rigi Zobeir-Rigi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 20, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 20, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@Zobeir-Rigi Zobeir-Rigi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 20, 2026

# 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...".
cd 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.

do we have the helper-files folder inside the cat directory?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No, it's in a different folder called the helper-files directory.

# It looked delicious.
# I was tempted to take a bite of it.
# But this seemed like a bad idea...
cat *.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 have txt files inside cat directory?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No, that's why I cd to the helper-files directory first.

# I was tempted to take a bite of it.
# But this seemed like a bad idea...
cat *.txt
pwd should be in the helper-files 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.

what will happen with this line during script execution?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

cat is a commond to print file contents
pwd, I'm just making sure to be in the related directory.

# 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-3.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.

Do we have helper-3.txt file inside the directory?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

All txt files are in the helper-files directory.

# 3 It looked delicious.
# 4 I was tempted to take a bite of it.
# 5 But this seemed like a bad idea...
cat * | nl 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.

What is the path to the folder we want to work with?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

helper-files directory, which is in the individual-shell-tools folder.


# 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 -ci "Doctor" dialogue.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.

What does -c param stand for in this case?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

To count the number of lines, which we don't need to count here, thanks for catching this. only -i is enough.


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

Choose a reason for hiding this comment

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

What will happen if we meet a line of a patient, for example, saying something like "Hello, Doctor!"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It will also be counted, and I should use this commond instead ===> grep -il "^Doctor:" *.txt
So, making sure started with the Doctor


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

Choose a reason for hiding this comment

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

What will happen if we meet a line of a patient, for example, saying something like "Hello, Doctor!"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

again it should be "^Doctor:" *.txt

# 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
#$NF → last column 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.

Like for the comment explaining the intention

# 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
# NF = total number of fields in the line, NF - 2 = removes name + city 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.

Like for explaining the intentions

@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 16, 2026
@SlideGauge
Copy link
Copy Markdown

Could you address my comments please, most of them are around the same issue with paths.

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