Question: Using an IDE or text editor of your choice, write a UNIX script for the given problem. Before submitting your solutions via Canvas, zip the
Using an IDE or text editor of your choice, write a UNIX script for the given problem. Before submitting your solutions via Canvas, zip the file and name the archive with your full name. For example, if your name is Harry Houdini, name the file HarryHoudini. zip.
Important:
The regular expressions that you provide must work in "egrep" or "grep E
egrep special expressions where the character, when followed by certain ordinary characters, takes on a special meaning are forbidden, including but not limited to: b B w W s and S
egrep commandline options are forbidden, including but not limited to: ivw and x
Write a script, regex. sh that defines the explicitly named shell variables to the corresponding regular expressions.
a
contains Foo, matches lines containing foo or Foo.
bj
oneUpper, matches lines containing exactly one uppercase letter, which occurs before any lowercase letters.
c
emptyLines, matches lines that are either completely empty or contain spaces only.
d
threeSets, matches lines with at least three sets of double letters the sets may or may not contain the same letters
e manyFLavors, matches lines containing flavor or flavour, where only the prefix fla is caseinsensitive.
f
mineMine, matches lines ending with two or more consecutive mine, separated by one or three spaces.
dateRange, matches lines that start with dates having the form YYYYMMDD for the last days of the Gregorian calendar year, inclusive, where the years range between and also inclusive.
h
LastFirstAndMiddLe, matches lines containing nothing but a full name in one of the following three forms: Last, First Middle, or Last, First M or Last, First. A name is defined as a capitalized sequence of letters with no space or punctuation characters in between. teLephoneNumber, matches lines consisting solely of a telephone number in the following form: xxxxxxxxxx where X is a digit, and the leftmost digit is odd.
doubLeMatchQuoted, matches lines containing a word surrounded by double quotes that has at least one set of double letters. A word is defined as a sequence of letters.
k
romanNumeral, matches lines consisting solely of a string that represents the numbers in roman numerals ie the string may only contain the characters I, V and X with the usual constraints on roman numerals
The following regex. sh is correct but incomplete, containing only the solution for part a:
$ cat regex.sh
containsFooFfjoo
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
