Question
Start your VM, log in as yourself and cd to the new directory in your home directory. You will use some of the files found
Start your VM, log in as yourself and cd to the new directory in your home directory. You will use some of the files found here along with three others that you will download using the following three wget commands. wget www.nku.edu/~foxr/equals.txt wget www.nku.edu/~foxr/names.txt wget www.nku.edu/~foxr/sentences.txt If these commands fail, it may be because your network interface is not connected. Go to lab 0 step 3.B.iv to see how to connect to the network. If www.nku.edu is unknown, try using sappho.nku.edu instead. The answers to these questions is to provide the appropriate egrep command to respond to the question given. 1. These questions pertain to the equals.txt file. a. Find all lines that contain an open parenthesis. Using the command egrep \( equals.txt b. Find all lines that contain an assignment statement of the form variable = value where value is a numeric value. [a-zA-Z]+\s*=\s*[0-9]+. c. Find all lines that contain a mathematical equation of the form value operator value = value where operator can be any mathematical operand and value is any numeric value. The equation does not have to be valid (for instance 9 * 10 = 11). '[0-9]+[[:space:]]*[-+*/][[:space:]]*[0-9]+[[:space:]]\s*=\s*[0-9]+ d. Find all lines that contain an assignment statement of the form variable = expression where expression can include numbers, variables (including $x), or arithmetic operators (a + 1). e. Find all lines that are sequences and not equations, assignment statements, if statements or function calls. A sequence is at least two groupings of letters and/or digits. For instance, A AB ABC ABCD is a sequence as is 123 ABC but A = B C D is not. 2. These questions pertain to the names.txt file. a. Find all entries that have an apartment designator in the address. Apartments can be noted using Apt or #. b. Find all entries where the persons first name is no more than 4 letters. c. Find all entries of people who have middle initials. d. Find all entries of addresses that are on a street (as indicated by St). Note: do not just search for St as you will find entries not on streets. e. Find all lines whose city name starts with either L, M or N. Note: do not just use [LMN] as the regex as this will locate people that have one of these capital letters anywhere in the line. f. Find all entries which do not have zip codes. Hint: look for entries that do not end in numbers. g. Find all entries that contain the letters a, b and c (in either upper or lower case) in that order. Other letters or characters can appear between them as in 101 Anderson St, Boulder, CO. h. Find all entries whose street address contains 2 digits or fewer (this can include a street address with no digits). i. Find all entries of people whose cities (if given) are at least 8 letters long. Make sure you do not just search for sequences of 8 letters as this could also get last names. j. Find all entries of people who live in cities whose names are multiple words. k. Find all entries where the street number is at least four digits long. Note: do not just use [0-9]{4,} because this will match zip codes. 3. These questions pertain to the sentences.txt file. a. Find all sentences that have words where there are two vowels in a row. b. Find all sentences that contain at least three words. c. Find all sentences that contain exactly four words. d. Find all sentences that contain punctuation marks prior to the last character of the line. The line can end with a punctuation mark as long as another appears earlier. 4. The following require that you perform a Linux command and pipe the result to egrep. These may require the use of ls (part d), ls l (part a-c), or ps aux (part e-g). a. Find the number of files in /dev that are character-type (character-type files have use the letter c for type instead of for regular files or d for directories). b. Find all devices in /dev that are group writable but not group readable. c. Find the files in ~Student/DUMMY-DIRECTORY that are writable by group. d. Find all files in /proc whose names are exactly 4-digit numbers (no 5-digit numbers) and return the number found e. Find all running processes whose time is greater than 0:00. Hint: look for anything that is not 0:00. f. Find all running processes whose status is S (but not Ss or Sl or S<, etc). NOTE: your egrep command itself is permissible in this list. g. Find all running processes whose owner is neither root nor your user. When done, close your terminal window and shut down your VM.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started