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. 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