Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions regex_1/README.md
Original file line number Diff line number Diff line change
@@ -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.

Comment on lines +3 to +4
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provide the information about the content 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.
17 changes: 17 additions & 0 deletions regex_1/evaluation_file.sh
Original file line number Diff line number Diff line change
@@ -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
Comment on lines +16 to +17
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exit 1 should be returned for all failed cases

exit 0 for success

1 change: 1 addition & 0 deletions regex_1/init.sh
Original file line number Diff line number Diff line change
@@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This produce everything will be in a single line. It would be better if it is multiple lines.