London | 26-SDC-Mar | Craig D'Silva | Sprint 2 | Shell Pipelines#395
London | 26-SDC-Mar | Craig D'Silva | Sprint 2 | Shell Pipelines#395craig-dsilva wants to merge 4 commits intoCodeYourFuture:mainfrom
Conversation
SlideGauge
left a comment
There was a problem hiding this comment.
Could you add trailing new lines to all the scripts? Doublecheck the settings of your editor, so it will place them automatically.
| # 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. | ||
|
|
||
| cat events.txt | sort | uniq -c No newline at end of file |
There was a problem hiding this comment.
It groups by the whole line (person + event type), so the output is 2 Entry German, 1 Entry Mariana, etc. - you have to sum those up yourself to get 5 and 4. The task says it should be clear from the output that there are 5 Entry and 4 Exit events.
| # 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. | ||
|
|
||
| cat events-with-timestamps.txt | awk '{print $3, $4;}' | grep -v 'Event' | sort | uniq -c No newline at end of file |
There was a problem hiding this comment.
This approach will use awk to extract both event and name, thus leading to similar problem as script-06.sh
| # TODO: Write a command to output scores-table.txt, with lines sorted by the person's first score, descending. | ||
| # The first line of your output should be "Basia London 22 9 6" (with no quotes). | ||
|
|
||
| sort -k3 -n -r scores-table.txt No newline at end of file |
There was a problem hiding this comment.
What does -k3 without specifying the end key mean and is it what we want here?
| # Piotr Glasgow 15 2 25 11 8 | ||
| # Chandra Birmingham 12 6 | ||
|
|
||
| sort -k3 -n -r scores-table.txt | head -n 3 No newline at end of file |
There was a problem hiding this comment.
What does -k3 without specifying the end key mean and is it what we want here?
| # 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 -n -r scores-table.txt | head -n 2 | tail -n 1 No newline at end of file |
There was a problem hiding this comment.
What does -k3 without specifying the end key mean and is it what we want here?
| # TODO: Write a command to output the names of the files in the sample-files directory whose name starts with an upper case letter and doesn't contain any other upper case letters. | ||
| # Your output should contain 7 files. | ||
|
|
||
| ls sample-files | grep '^[A-Z]' | grep -vE '.[A-Z]' No newline at end of file |
There was a problem hiding this comment.
Creative use of piping of greps, like.
|
Could you apply fixes to the points I described? |
Learners, PR Template
Self checklist
Changelist
This is the coursework for the Shell pipelines exercise