Skip to content

London | 26-SDC-Mar | Mariia Serhiienko | Sprint 2 | Shell pipelines#440

Open
Konvaly wants to merge 3 commits into
CodeYourFuture:mainfrom
Konvaly:shell-pipelines
Open

London | 26-SDC-Mar | Mariia Serhiienko | Sprint 2 | Shell pipelines#440
Konvaly wants to merge 3 commits into
CodeYourFuture:mainfrom
Konvaly:shell-pipelines

Conversation

@Konvaly
Copy link
Copy Markdown

@Konvaly Konvaly commented Mar 27, 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

Completed tasks with commands ls-grep-sort-uniq-grep-tail-tr

@Konvaly Konvaly added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 27, 2026
# The input for this script is the scores-table.txt file.
# TODO: Write a command to output scores-table.txt, with shows the line for the player whose first score was the second highest.
# Your output should be: "Piotr Glasgow 15 2 25 11 8" (without quotes).
sort -k3 -rn scores-table.txt | head -2 | tail -1 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.

Note:
I was curious and asked AI's which of the following ways of using head and tail is preferred:

  1. head -2 | tail -1
  2. head -n 2 | tail -n 1

They suggested the 2nd syntax for compatibility and readability reasons.

# 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 -c | sort -k2 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.

The output produced by your command does not quite match the expected output, which is in the form:

5 Entry
4 Exit

# 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.
tail -n +2 events-with-timestamps.txt | cut -d' ' -f3 | sort | uniq -c 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.

`cut -d' ' -f3 works only if the fields on each line is separated by EXACTLY one space.
The fields in the given file are separated by a tab key, so the command won't work.

@cjyuan cjyuan 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 May 12, 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