London | 26-SDC-Mar | Beko | Sprint 1 | Individual shell tools exercises#352
London | 26-SDC-Mar | Beko | Sprint 1 | Individual shell tools exercises#352Abubakar-Meigag wants to merge 1 commit intoCodeYourFuture:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
SlideGauge
left a comment
There was a problem hiding this comment.
There a couple of files which do not have empty line in the end of the file (like wc/script-02.sh). Could you add them please
|
|
||
| set -euo pipefail | ||
|
|
||
| awk '{print NF}' scores-table.txt |
There was a problem hiding this comment.
What does NF mean in this context and what will this line output?
|
|
||
| set -euo pipefail | ||
|
|
||
| awk '/London/ {print $1, $4}' scores-table.txt |
There was a problem hiding this comment.
What happens when we meet lines with different number of scores?
| set -euo pipefail | ||
|
|
||
|
|
||
| grep -v "Hello" dialogue.txt |
There was a problem hiding this comment.
Will it find lines like "hello" (lowercase)?
| # TODO: Write a command to list the files and folders in this directory. | ||
| # The output should be a list of names including child-directory, script-01.sh, script-02.sh, and more. | ||
|
|
||
| ls ../ls |
There was a problem hiding this comment.
README file says
"You should write all of your scripts assuming they're running inside the directory they're saved in."
Whilst this line works, it does redundant operation with the path, could you simplify it?
| # TODO: Write a command which lists all of the files in the directory named child-directory. | ||
| # The output should be a list of names: helper-1.txt, helper-2.txt, helper-3.txt. | ||
|
|
||
| ls ../ls/child-directory No newline at end of file |
There was a problem hiding this comment.
README file says
"You should write all of your scripts assuming they're running inside the directory they're saved in."
Whilst this line works, it does redundant operation with the path, could you simplify it?
|
|
||
| echo "First exercise (sorted newest to oldest):" | ||
|
|
||
| ls -t ../ls/child-directory |
There was a problem hiding this comment.
README file says
"You should write all of your scripts assuming they're running inside the directory they're saved in."
Whilst this line works, it does redundant operation with the path, could you simplify it?
| # The output should be a list of names including: child-directory, script-01.sh, helper-1.txt (and more). | ||
| # The formatting of the output doesn't matter. | ||
|
|
||
| ls ../ls ../ls/child-directory No newline at end of file |
There was a problem hiding this comment.
Also, will it output directories contents recursively?
|
|
||
| set -euo pipefail | ||
|
|
||
| grep -l "Doctor:" *.txt |
There was a problem hiding this comment.
Will it output only lines of the Doctor or can it potentially output lines which contain "Doctor:" somewhere in the middle?
|
|
||
| set -euo pipefail | ||
|
|
||
| awk '/London/ {print $1, $4}' scores-table.txt |
There was a problem hiding this comment.
What will happen if some of the player's have name "London" but the city is not London?
|
|
||
| set -euo pipefail | ||
|
|
||
| awk '{for (i=3; i<=NF; i++) sum[$1] += $i} END {for (name in sum) print name, sum[name]}' scores-table.txt |
There was a problem hiding this comment.
Does for (name in sum) guarantee the order of traversal?
|
Wrote my notes, could you fulfil them please? |
Self checklist
Changelist
complete individual shell tools exercises
Questions
no questions, thanks!