-
-
Notifications
You must be signed in to change notification settings - Fork 88
London | 25-SDC-Nov | Jesus del Moral | Sprint 1| Individual Shell Tools #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
1389f33
ef7cbca
ba10ca7
e6044e1
7603f82
1f5a640
2ce0147
e2e1cf8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,3 +13,14 @@ set -euo pipefail | |
| # 3 It looked delicious. | ||
| # 4 I was tempted to take a bite of it. | ||
| # 5 But this seemed like a bad idea... | ||
|
|
||
|
|
||
|
|
||
| nl -b a ../helper-files/helper-1.txt ../helper-files/helper-2.txt ../helper-files/helper-3.txt | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my comment above about using a wildcard instead of listing each file
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function has been modified |
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,6 @@ set -euo pipefail | |
|
|
||
| # TODO: Write a command to output the number of lines in dialogue.txt that contain the word Doctor (regardless of case). | ||
| # The output should be exactly the number 9. | ||
|
|
||
| grep -n "Doctor" dialogue.txt -i | wc -l | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there an option you can use instead of piping to wc?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function has been modified |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,7 @@ set -euo pipefail | |
|
|
||
| # TODO: Write a command to output, for each `.txt` file in this directory, how many lines of dialogue the Doctor has. | ||
| # The output should show that dialogue.txt contains 6 lines, dialogue-2.txt contains 2, and dialogue-3.txt contains 0. | ||
|
|
||
| for f in *.txt; do | ||
| echo "$f: $(grep -i "^Doctor:" "$f" | wc -l)" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an interesting approach. It should be possible to complete with a single grep command, though. Can you figure out how? |
||
| done | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way of doing the same without manually listing every file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function has been modified