diff --git a/individual-shell-tools/grep/script-03.sh b/individual-shell-tools/grep/script-03.sh index 5383fe5..873f6ee 100755 --- a/individual-shell-tools/grep/script-03.sh +++ b/individual-shell-tools/grep/script-03.sh @@ -4,3 +4,5 @@ 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 -c 'Doctor' dialogue.txt diff --git a/individual-shell-tools/grep/script-05.sh b/individual-shell-tools/grep/script-05.sh index 1eb5381..c1a8f99 100755 --- a/individual-shell-tools/grep/script-05.sh +++ b/individual-shell-tools/grep/script-05.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that contains the string "cure", as well as the line before that line. # The output should contain two pairs of two lines of text (with a separator between them). + +grep -A 1 'cure' dialogue.txt diff --git a/individual-shell-tools/grep/script-07.sh b/individual-shell-tools/grep/script-07.sh index 9670eba..bc91c59 100755 --- a/individual-shell-tools/grep/script-07.sh +++ b/individual-shell-tools/grep/script-07.sh @@ -4,3 +4,5 @@ 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:' ./*.txt