Glasgow | 26- SDC-Mar | Taras Mykytiuk | Sprint 2 | Shell pipelines#418
Open
TarasMykytiuk wants to merge 3 commits into
Open
Glasgow | 26- SDC-Mar | Taras Mykytiuk | Sprint 2 | Shell pipelines#418TarasMykytiuk wants to merge 3 commits into
TarasMykytiuk wants to merge 3 commits into
Conversation
cjyuan
reviewed
May 12, 2026
| set -euo pipefail | ||
|
|
||
| # TODO: Write a command to output the names of the files in the sample-files directory whose name starts with an upper case letter. | ||
| ls sample-files | grep '\b[A-Z]' |
There was a problem hiding this comment.
\b won't work for filenames like abc.Xyz because . is considered a word boundary.
Hint: There is a regex symbol that matches "beginning of a string".
| set -euo pipefail | ||
|
|
||
| # 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. | ||
| ls sample-files | grep -w '[A-Z][a-z]*' |
There was a problem hiding this comment.
-
Filenames are listed one filename per line.
-woption does not help. -
Also, the regex should also work for filenames like
A123.jpg,B$$$.txt.
Note: The same also apply to script-04.sh
Comment on lines
+7
to
+8
| cat events.txt | grep 'Entry' | sort -u | wc -l | sed 's/$/ entries/' | ||
| cat events.txt | grep 'Exit' | sort -u | wc -l | sed 's/$/ exits/' |
There was a problem hiding this comment.
Can you use only ONE command to produce an output in the form:
5 Entry
4 Exit
?
Hint: Extract the words in the first column first.
The same applies also to script-07.sh.
|
|
||
| # The input for this script is the scores-table.txt file. | ||
| # TODO: Write a command to output scores-table.txt, with lines sorted by the person's first score, descending. | ||
| sort scores-table.txt -k3 -n -r |
There was a problem hiding this comment.
Common practice is to specify options before the filename.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Shell pipelines exercises are done.