-
-
Notifications
You must be signed in to change notification settings - Fork 42
ZA | 25-SDC-July | Luke Manyamazi | Sprint 1 | Individual Shell Tools #121
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 30 commits
50925a9
6a2e2ac
0b11f9b
614a645
c6a3f99
18507cb
8682de1
8726192
43199e4
1d40453
94c7941
fc0bd02
2d4fb9b
6412b49
8f6f809
45066a8
04b3d65
ba9aeed
7e46344
201a5c7
228b667
a090b37
fe8fac4
1fe9d18
fdab745
8ee5f3c
bfd885a
865a951
b3014a0
1ba1cb0
3d73eba
899d540
d761aa0
ad5f456
bbebb02
efcb635
4ffbb67
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 |
|---|---|---|
|
|
@@ -4,3 +4,6 @@ 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. | ||
| grep -c '^Doctor:' "$(dirname "$0")"/*.txt | while IFS=: read -r file count; do | ||
|
||
| echo "$(basename "$file") contains $count lines" | ||
| done | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,5 @@ set -euo pipefail | |
|
|
||
| # TODO: Write a command which lists all of the files in the directory named child-directory. | ||
| # The output should be a list of names: helper-1.txt, helper-2.txt, helper-3.txt. | ||
| cd /home/luke/CYF/SDC/Module-Tools/individual-shell-tools/ls/child-directory | ||
| ls | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,7 @@ set -euo pipefail | |
| # TODO: Write a command to output input.txt with all occurrences of the letter `i` replaced with `I`. | ||
| # The output should contain 11 lines. | ||
| # The first line of the output should be: "ThIs Is a sample fIle for experImentIng with sed.". | ||
| sed 's/i/I/g' "$(dirname "$0")/input.txt" | while IFS= read -r line; do | ||
|
||
| echo "$line" | ||
| done | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ set -euo pipefail | |
|
|
||
| # TODO: Write a command to output input.txt replacing every occurrence of the string "We'll" with "We will". | ||
| # The output should contain 11 lines. | ||
| sed 's/We'\''ll/We will/g' "$(dirname "$0")"/input.txt | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ set -euo pipefail | |
|
|
||
| # TODO: Write a command to output the number of words in the file helper-files/helper-3.txt. | ||
| # The output should include the number 19. The output should not include the number 92. | ||
| wc -w "$(dirname "$0")"/../helper-files/helper-3.txt | awk '{print $1}' | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,4 @@ set -euo pipefail | |
| # 1 7 39 ../helper-files/helper-2.txt | ||
| # 3 19 92 ../helper-files/helper-3.txt | ||
| # 5 30 151 total | ||
| wc -lwm "$(dirname "$0")"/../helper-files/*.txt | ||
|
||
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 -l argument will make it print the filename - why are you using the basename command as well?