Chapter 15 ExercisesRead Chapter 15 of the Unix text and work on the Unix system. Make sure you can answer the following questions:Chapter 15 sed - text Stream Editor(Pages 650 - 672) 15-1. Why do we usually enclose the arguments to sed in quotes? 15-2. Under what circumstances would sed be faster/easier than using an interactive editor? 15-3. Give the sed command that will display fileA with lines 3 through 5 deleted.. 15-4. Give the sed command that will display the top 7 lines from the file called fileA. 15-5. Give the sed command that will print only the lines starting at line 7 and ending with the first line that ends with the letters Bursary. No other lines should be displayed. (Suppress the default output.) [p.659,671] 15-6a. Give the sed command that will display every non-empty line in fileA.[p.660] (An empty line is one containing nothing - no characters.) 15-6b. Give the sed command that will display every non-empty, non-blank line in fileA. (A blank line is a line containing only blanks - space characters.) 15-7. Give the single sed command that will display fileA with all occurrences of your Unix userid (use the appropriate shell variable, not your actual userid!) replaced by SECRET and all occurrences of algonquincollege.com replaced by ALGONQUIN, no matter how many times they occur on each line. [p.661,670] (Make sure you do not match or change text such as algonquincollegeXcom.) 15-8. Give the shell sed command line that will delete all lines containing two adjacent dollar signs ("$$"). (Be sure to test this one - the correct pattern is important!) 15-9. Give the sed command that will display all lines from fileA, with the text from the file called decadent appended after any line beginning with the letters Chocolate. [p.664] These exercises created originally by Maitang Mark |
Web Author: Ian! D. Allen idallen@ncf.ca |