What do these commands do? Answer the questions below using your own words and justify your answers with commands and their outputs XXXXXXXXXXi) grep a b c XXXXXXXXXXii) grep ‘boswana.*birds’ *.htm*...

What do these commands do? Answer the questions below using your own words and justify your answers with commands and their outputs. (i) grep a b c (ii) grep ‘boswana.*birds’ *.htm* Note: be sure to explain the differences between the * in the pattern and the two *s in *.htm* (iii) grep * Note: As you know, shell will expand * into as many file names under the current directory as it possibly can. Explain what grep will do in three situations: when * expands to 0, 1, or more than 1 file names. In a file a7_p1.txt, answer
each question above one by one. Copy and paste the command(s) and output(s) from your terminal (include only those pertaining to this question) to justify your answers. Problem 2 (4 points) Are the following two commands equivalent?
Why? Hint: pay attention to the lines in foo that contain nothing, i.e. blank lines. grep “^[^a-z]” foo grep –v “^[a-z]” foo In a file a7_p2.txt, answer the question. Then copy and paste the command(s) and output(s) from your terminal (include only those pertaining to this question) to justify your answer.


CS3300 UNIX Programming Assignment 7 Due April 16, 2021 at 5:00pm Assignment Guidelines 1. You should individually complete this lab either on your personal Linux laptop, or Google Cloud, or the Gargamel server. Don’t use Mac for this assignment. 2. For all problems below, you are assumed to run necessary commands (such as creating files/folders) to get ready for the demonstration of the pertaining commands. 3. Assignment work should be sent to me prior to the deadline in BlazeVIEW. Late submissions will not be accepted. Assignment Problems Problem 1 (9 points) What do these commands do? Answer the questions below using your own words and justify your answers with commands and their outputs. (i) grep a b c (ii) grep ‘boswana.*birds’ *.htm* Note: be sure to explain the differences between the * in the pattern and the two *s in *.htm* (iii) grep * Note: As you know, shell will expand * into as many file names under the current directory as it possibly can. Explain what grep will do in three situations: when * expands to 0, 1, or more than 1 file names. In a file a7_p1.txt, answer each question above one by one. Copy and paste the command(s) and output(s) from your terminal (include only those pertaining to this question) to justify your answers. Problem 2 (4 points) Are the following two commands equivalent? Why? Hint: pay attention to the lines in foo that contain nothing, i.e. blank lines. grep “^[^a-z]” foo grep –v “^[a-z]” foo In a file a7_p2.txt, answer the question. Then copy and paste the command(s) and output(s) from your terminal (include only those pertaining to this question) to justify your answer. Problem 3 (4 points). In the file of foo, how do you locate and print all lines containing printf, BUT NOT sprintf and fprintf, anywhere but at the end of a line? Hint: use pipe “|” to form a sequence of grep commands, each in charge of one filtering task. In a file a7_p3.txt, copy and paste the command(s) and output(s) from your terminal (include only those pertaining to this question) to justify your answer. Problem 4 (4 points). How do you locate and print all nonblank lines that don’t begin with #, /*, or // in a file called foo? Hint: first, specify a pattern that matches lines that DO begin with #, /*, or //, or simply blank. Then use the –v option for grep to negate it. In a file a7_p4.txt, copy and paste the command(s) and output(s) from your terminal (include only those pertaining to this question) to justify your answer. What to turn in? a7_p1.txt a7_p2.txt a7_p3.txt a7_p4.txt
Dec 09, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here