London | 26-SDC-July | Raihan Sharif | Sprint 1 | individual-shell-tools#566
London | 26-SDC-July | Raihan Sharif | Sprint 1 | individual-shell-tools#566RaihanSharif wants to merge 32 commits into
Conversation
|
Results of test: |
SlideGauge
left a comment
There was a problem hiding this comment.
Good job, I got just a couple of comments from my side, fix them please.
|
|
||
| # 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. | ||
| # The output should be a list of names in this order, one per line: helper-3.txt, helper-1.txt, helper-2.txt. | ||
| ls -1t |
There was a problem hiding this comment.
Right now the script targets the current dir. Is that what we're asked for?
|
|
||
| # TODO: Write a command to output every line in dialogue.txt that does not contain the word "Hello" (regardless of case). | ||
| # The output should contain 10 lines. | ||
| grep -vi 'hello' ./dialogue.txt | grep . No newline at end of file |
There was a problem hiding this comment.
The task is to output 10 lines. Does this script do this?
|
|
||
| # -E is extended regex, needed for + (one or more) quantifier | ||
| # [[:space:]] is POSIX compliant | ||
| sed -E s'/[0-9]+[[:space:]]//g' ./input.txt |
There was a problem hiding this comment.
Note, that the output should be " Alisha", not "Alisha". Space has been lost
| # -n prevent default printing behaviour | ||
| # ! negates regex match, i.e. gets lines that don't match | ||
| # p prints | ||
| sed -n ':[0-9]:!p' input.txt |
There was a problem hiding this comment.
an address regex must be delimited with /…/, not :…:
| # space after number is part of the pattern but not the group | ||
| # 2 is everything else | ||
| # then print out group 2, a space, and then group 1 | ||
| sed -E 's/^([0-9]+) (.*)/\2 \1/' input.txt |
There was a problem hiding this comment.
Clean capture-group swap with a clear comment explaining each group. Well done on one of the trickier ones.
Learners, PR Template
Self checklist
Changelist
Completed all exercises for individual shell tools