Hello can anyone help me on this question and answer it all

Hello, can anyone help me on this question and answer it all for me? I\'m quite struggling and don\'t know what to do here your help will be a life saver and i appreciate it. thank you!

Assignment 4 questions and inputs:

write egrep commands to match all lines that contain the letter a and b(either upper or lower case) and all lines that conatin the word a(either upper or lower case) followed by a word starting with a vowel and test it on the given input.

Assignment 4 input test:

a apple
A elephant
a banana
zero
yellow yaks
zippy zebras

Assignment 5 questions and input:

edit the regex [0-9]?[0-9]:[0-9][0-9](am|pm) so it doesn\'t match illegal time like 99:99pm

Assignment 5 test input: use the egrep command to teest it on the inputs

10:31am
9:30pm
9:30
9:3am
99:99pm

Assignment 6:

print \"Enter a temperature (i.e. 32F, 100C):\ \";
$input = ; # this will read one line from the user
chop($input);   # this removes the ending newline from $input

if ($input =~ m/^([-+]?[0.-9]+)([Cc|fF])$/)
{
   # If we get in here, we had a match.
   # $1 is the number and $2 is \"C\" or \"F\"
   $InputNum = $1;   # save to named variables to make easier to read
   $type = $2;
   $space = \" \";
   if ($type eq \"C\") {
       $celsius = $InputNum;
       $fahrenheit = ($celsius * 9 / 5) + 32;
   }
   else {
       $fahrenheit = $InputNum;
       $celsius = ($fahrenheit - 32) * 5 / 9;
   }
   printf \"%.2f C = %.2f F\ \", $celsius, $fahrenheit;
}
else {
   print \"Expecting a number, so don\'t understand \\\"$input\\\".\ \";
}

Assignment 2 Write a regular expression for each of the following languages and test it for correctness in LAP. 1. The language with an even number of a s followed by an odd number of b\'s 2. The language with zero or more a\'s followed three or fewer b\'s by 3. The language in which every a must have b adjace to it on both sides.

Solution

Assignment 2:

b)

^a*(bbb)*

c)

(bab)*

Assignment 4:

a)All lines that contain letter a and b (either Upper or lower)

egrep \"*[abAB]*\" filename

note: here filename can be any path or name of a file

as given in question 4 filename will be jillz/cs250/lab3/testfile1

b)All lines that contains the word a and followed by word starting with vowel

egrep \"^[aA] [aeiou]*\" filename

Assignment 5:

edit the regex [0-9]?[0-9]:[0-9][0-9](am|pm) so it doesn\'t match illegal time like 99:99pm

egrep \"[0-1]?[0-2]:[0-5][0-9](am|pm)\"jillz/cs250/lab3/testfile1

Hello, can anyone help me on this question and answer it all for me? I\'m quite struggling and don\'t know what to do here your help will be a life saver and i
Hello, can anyone help me on this question and answer it all for me? I\'m quite struggling and don\'t know what to do here your help will be a life saver and i

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site