Skip to content

Commit 9c87e2d

Browse files
updates
1 parent a789e9b commit 9c87e2d

14 files changed

Lines changed: 14 additions & 13 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
.env

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +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 contains at least one upper case letter.
66
# Your output should contain 11 files.
7-
ls sample-files | grep '[A-Z]'
7+
ls sample-files | grep '[A-Z]'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +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 sample-files | grep '^[A-Z]' # ^ -> starts line with [A_Z]
7+
ls sample-files | grep '^[A-Z]' # ^ -> starts line with [A_Z]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +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 sample-files | grep '^[A-Z][a-z]*$' # [a-z]* = zero or more lowercase after that , $ = end of this line grep
7+
ls sample-files | grep '^[A-Z][^A-Z]*$' # ^[A-Z] start with one uppercase -- [^A-Z]*$ zero or more char that are not upper case after that , $ = end of this line grep

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

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

55
# 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.
66
# Your output should be the number 7.
7-
ls sample-files | grep -c '^[A-Z][a-z]*$' # -c to count lines
7+
ls sample-files | grep -c '^[A-Z][^A-Z]*$' # -c to count lines

shell-pipelines/sort-uniq-head-tail/script-01.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ set -euo pipefail
55
# The input for this script is the scores-table.txt file.
66
# TODO: Write a command to output scores-table.txt, with lines sorted by the person's name.
77
# The first line of your output should be "Ahmed London 1 10 4" (with no quotes). And the third line should be "Chandra Birmingham 12 6".
8-
sort -k1,1 scores-table.txt # -k 'column' starts -k1 and end ,1 column
8+
sort -k1,1 scores-table.txt # -k 'column' starts -k1 and end ,1 column

shell-pipelines/sort-uniq-head-tail/script-02.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ set -euo pipefail
55
# The input for this script is the scores-table.txt file.
66
# TODO: Write a command to output scores-table.txt, with lines sorted by the person's first score, descending.
77
# The first line of your output should be "Basia London 22 9 6" (with no quotes).
8-
sort -k3,3nr scores-table.txt # nr = from largest to smallest
8+
sort -k3,3nr scores-table.txt # nr = from largest to smallest

shell-pipelines/sort-uniq-head-tail/script-03.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ set -euo pipefail
88
# Basia London 22 9 6
99
# Piotr Glasgow 15 2 25 11 8
1010
# Chandra Birmingham 12 6
11-
sort -k3,3nr scores-table.txt | head -n 3 # head -n3 = takes only the first 3 lines
11+
sort -k3,3nr scores-table.txt | head -n 3 # head -n3 = takes only the first 3 lines

shell-pipelines/sort-uniq-head-tail/script-04.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ set -euo pipefail
55
# The input for this script is the scores-table.txt file.
66
# TODO: Write a command to output scores-table.txt, with shows the line for the player whose first score was the second highest.
77
# Your output should be: "Piotr Glasgow 15 2 25 11 8" (without quotes).
8-
sort -k3,3nr scores-table.txt | head -n 2 | tail -n 1 # we get first two top and show last one with tail which is second one
8+
sort -k3,3nr scores-table.txt | head -n 2 | tail -n 1 # we get first two top and show last one with tail which is second one

shell-pipelines/sort-uniq-head-tail/script-05.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ set -euo pipefail
66
# TODO: Write a command to show a list of all events that have happened, without duplication.
77
# The order they're displayed doesn't matter, but we never want to see the same event listed twice.
88
# Your output should contain 6 lines.
9-
sort -u events.txt # first sort them and then remove dublicates
9+
sort -u events.txt # first sort them and then remove dublicates

0 commit comments

Comments
 (0)