-
-
Notifications
You must be signed in to change notification settings - Fork 42
London | Samira Hekmati | Module Tools | Week 1 | Individual-Shell-Tools #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
London | Samira Hekmati | Module Tools | Week 1 | Individual-Shell-Tools #24
Conversation
ehwus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great work, you've demonstrated a really good understanding of the shell tools and bash scripting in general that will be a solid base for the remainder of the course and your career. There are some issues that I've raised with the way that the PR was presented, but those are all largely to do with attention to detail in pull requests, and it's very clear that you have understood the material well.
|
|
||
| awk '/London/ {print $1, $NF}' scores-table.txt | ||
|
|
||
| awk '{if($2 == "London")print $1, $NF}' scores-table.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: great to see you hit the strech goals here!
| # 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: great demonstration of performing a sum in awk here!
|
|
||
|
|
||
|
|
||
| # method 1 (relative path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # I was tempted to take a bite of it. | ||
| # But this seemed like a bad idea... | ||
|
|
||
| echo hello world |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: Lines like this are great for debugging and setting things up / learning, but lets make sure that we're removing them before submitting work for review.
|
|
||
| echo hello world | ||
|
|
||
| cat ../helper-files/*.txt No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: good use of the wildcard here, and the extension is a clever way to make sure that only text files would ever be read
|
|
||
| cat ../helper-files/*.txt | cat -n | ||
|
|
||
| # cat ../helper-files/*.txt first combines all files into a single stream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: comments like this are great for showing your working! I think following this pattern in other cases where you've left duplicate code uncommented in the script would be great.
| # The output should be a list of names: helper-1.txt, helper-2.txt, helper-3.txt. | ||
|
|
||
|
|
||
| cd child-directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: This definitely works, but can we do it without changing directory?
|
|
||
| echo "Move the starting number to the end of the line:" | ||
|
|
||
| sed 's/^\([0-9]*\) \(.*\)$/\2 \1/' input.txt No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: great regular expression usage here!


Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.