Glasgow | 25-SDC-NOV | Katarzyna Kazimierczuk | Sprint 2 | shell pipelines#323
Glasgow | 25-SDC-NOV | Katarzyna Kazimierczuk | Sprint 2 | shell pipelines#323katarzynakaz wants to merge 1 commit intoCodeYourFuture:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
SlideGauge
left a comment
There was a problem hiding this comment.
Some files do not have trailingline ending, could you add it?
| # The author got feedback that they're using too many exclamation marks (!). | ||
| # | ||
| # TODO: Write a command to output the contents of text.txt with every exclamation mark (!) replaced with a full-stop (.). | ||
| cat * text.txt | tr '!' '.' No newline at end of file |
| # so every Y should be a Z, and every Z should be a Y! | ||
| # | ||
| # TODO: Write a command to output the contents of text.txt with every Y and Z swapped (both upper and lower case). | ||
| cat * text.txt | tr 'Y' 'Z' | tr 'Z' 'Y' | tr 'y' 'z' | tr 'z' 'y' No newline at end of file |
| # so every Y should be a Z, and every Z should be a Y! | ||
| # | ||
| # TODO: Write a command to output the contents of text.txt with every Y and Z swapped (both upper and lower case). | ||
| cat * text.txt | tr 'Y' 'Z' | tr 'Z' 'Y' | tr 'y' 'z' | tr 'z' 'y' No newline at end of file |
There was a problem hiding this comment.
The current result makes several steps one by one: at first it converts Y -> Z, then it converts Z -> Y. Thus, instead of swapping, it effectively removes all Z from the file. Could modify tr in such a way it will simultaneously applied to the text.txt?
| # 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 scores-table.txt -k3 -n -r | head -3 | tail -2 | head -1 No newline at end of file |
There was a problem hiding this comment.
head -3 takes 3 first lines, then grabs 2 from the tail then takes 1. We can have the same outcome by taking 2 first and then 1 from the tail
| # 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. | ||
| grep -c 'Entry' events.txt | sort |
There was a problem hiding this comment.
Two issues: (1) Piping grep -c output to sort is pointless — grep -c outputs a single number, sorting one number does nothing. (2) The task says "It should be clear from your script's output" what the numbers mean, but the output is just 5 and 4 with no labels.
| # 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. | ||
| # echo "Entry: ${grep -c 'Entry' events-with-timestamps.txt}" |
There was a problem hiding this comment.
The commented-out lines (# echo "Entry: ${grep ...}") are debug leftovers showing the earlier wrong syntax. Could you remove them?
Self checklist
Changelist
Pipelines completed