-
Notifications
You must be signed in to change notification settings - Fork 6
Regex Question 1 #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Regex Question 1 #33
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. | ||
|
|
||
| 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. | ||
| 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
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| 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 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
There was a problem hiding this comment.
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.