Skip to content

Commit f8cff23

Browse files
committed
Ls/Grep
1 parent 407b010 commit f8cff23

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

shell-pipelines/ls-grep/script-01.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ set -euo pipefail
44

55
# TODO: Write a command to output the names of the files in the sample-files directory whose name contains at least one upper case letter.
66
# Your output should contain 11 files.
7+
8+
9+
ls -1 sample-files | grep '[A-Z]' |nl

shell-pipelines/ls-grep/script-02.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ set -euo pipefail
44

55
# TODO: Write a command to output the names of the files in the sample-files directory whose name starts with an upper case letter.
66
# Your output should contain 10 files.
7+
ls -1 sample-files | grep '^[A-Z]' | nl

shell-pipelines/ls-grep/script-03.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ set -euo pipefail
44

55
# 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.
66
# Your output should contain 7 files.
7+
ls -1 sample-files | grep '^[A-Z][^A-Z]*$' | nl

shell-pipelines/ls-grep/script-04.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22

33
set -euo pipefail
44

5-
# TODO: Write a command to count the number of files in the sample-files directory whose name starts with an upper case letter and doesn't contain any other upper case letters.
5+
# TODO: Write a command to count the number of files in the sample-files directory
6+
# whose name starts with an upper case letter and doesn't contain any other upper case letters.
67
# Your output should be the number 7.
8+
ls sample-files | grep '^[A-Z][^A-Z]*$' | wc -l

0 commit comments

Comments
 (0)