From dbdda63bb3e2b3c85c6104a8d6fc54f9588dc753 Mon Sep 17 00:00:00 2001 From: Prabuddh Mathur Date: Thu, 20 Jul 2023 13:33:02 +0530 Subject: [PATCH 1/2] Regex Question 1 --- regex_1/evaluation_file.sh | 17 +++++++++++++++++ regex_1/init.sh | 1 + 2 files changed, 18 insertions(+) create mode 100755 regex_1/evaluation_file.sh create mode 100755 regex_1/init.sh diff --git a/regex_1/evaluation_file.sh b/regex_1/evaluation_file.sh new file mode 100755 index 0000000..5e22a71 --- /dev/null +++ b/regex_1/evaluation_file.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +if ! [ -f ~/se2001/regex_1/script.sh ]; then + echo "File $HOME/se2001/regex_1/script.sh not found" >&2 + exit 1 +fi + +if ! [ -x ~/se2001/regex_1/script.sh ]; then + echo "File $HOME/se2001/regex_1/script.sh is not executable" >&2 + exit 1 +fi + +if [[ `~/se2001/regex_1/script.sh | wc -l` -eq `wc -l pattern.txt | awk '{print $1}'` ]];then + echo 'Evaluation Successful' +else + echo 'Evaluation Failed' +fi diff --git a/regex_1/init.sh b/regex_1/init.sh new file mode 100755 index 0000000..ae96e9b --- /dev/null +++ b/regex_1/init.sh @@ -0,0 +1 @@ +echo {A..B}{E..F}{I..K}{0..1}{5..6}{I..J}{5..6}{C..D}{1..2}{5..6}{2..3}{4..5}{8..9}{3..4}{6..7}{2..3} > match.txt From 5918a829d2ce47921143db9932517c58f72ede84 Mon Sep 17 00:00:00 2001 From: Prabuddh Mathur Date: Thu, 20 Jul 2023 14:34:55 +0530 Subject: [PATCH 2/2] Regex question 1 --- regex_1/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 regex_1/README.md diff --git a/regex_1/README.md b/regex_1/README.md new file mode 100644 index 0000000..d19a55a --- /dev/null +++ b/regex_1/README.md @@ -0,0 +1,7 @@ +# RegEx Problem 1 + +There is a file named ` match.txt ` in the current working directory, that contains some text that is to be matched. + +Write your command in a file named ` script.sh ` which achieves the same. + +Note : Run ` synchro init ` to get the file ` match.txt ` to your solutions directory. Use ` head ` command to check of a portion of its contents.