Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What grep and sort commands are needed for this assignment? 4. You need to use commands sort and grep to finish this Lab assignment. Spend

What grep and sort commands are needed for this assignment?image text in transcribed

4. You need to use commands sort and grep to finish this Lab assignment. Spend some time to read the manual pages of commands sort and grep respectively by typing the following commands at the prompt $ $ man sort man grep You can also read the reference part at the end of this document for sort command and lecture notes for grep command 5. The problem you need to solve for this lab assignment is: (1) to sort all the buildings from UkY_buildings.txt you downloaded from step 3, in Lexicographical order (dictionary order) by building name. (2) to search from the sorted file in step(1) and find all the buildings, which start with "D" and the coordinates shown in the map are in the range of B5 to B7 (including B5, B6 and B7), and print them (with line numbers from the input file) to an output file, named Lab2output.txt. (3) to search from the sorted file in step(1) and find all the buildings which contain "ter" as part of the building name (Ignore case distinctions) and the coordinates shown in the map are either C6 to C7, or D6 to D7, and print (append) them (with line numbers from the input file), at the end of the same output file, named Lab2output.txt The following is the sample output of Lab2output.txt: 129 David P. Roselle Hall 130:Davis Marksbury Building 0633 138 Digital Village 1 139:Digital Village 2 8 Appalachian Center Anne:x 68: Boone Center 0:Bus Shelter 3 0392 87:Center for Robotics and Manufacturing Systems 101 Chem-Physics Bus Shelter 0392 225 Hilary J. Boone Center 349:Patterson office Tower 432 :Terrell Civil Engineering Building 451 Visitor Center 0568 B6 B5 0495 0633 B5 0333 D7 0014 D6 D6 0108 D7 0014 0027 D6 D6 C6 0052 D7 0032 C7 Note the first FOUR lines is the result from matching the pattern (2): buildings starting with "D" and the coordinates shown in the map are in the range of B5 to B7 (including B5, B6 and B7); and the rest part is the result from matching the pattern (3): buildings which contain "ter" as part of the building name (Ignore case distinctions) and the coordinates shown in the map are either C6 to C7, or D6 to D7 6.type the following command at the prompt $, then click "Enter" key. history |tail -10 >> Lab2output.txt 4. You need to use commands sort and grep to finish this Lab assignment. Spend some time to read the manual pages of commands sort and grep respectively by typing the following commands at the prompt $ $ man sort man grep You can also read the reference part at the end of this document for sort command and lecture notes for grep command 5. The problem you need to solve for this lab assignment is: (1) to sort all the buildings from UkY_buildings.txt you downloaded from step 3, in Lexicographical order (dictionary order) by building name. (2) to search from the sorted file in step(1) and find all the buildings, which start with "D" and the coordinates shown in the map are in the range of B5 to B7 (including B5, B6 and B7), and print them (with line numbers from the input file) to an output file, named Lab2output.txt. (3) to search from the sorted file in step(1) and find all the buildings which contain "ter" as part of the building name (Ignore case distinctions) and the coordinates shown in the map are either C6 to C7, or D6 to D7, and print (append) them (with line numbers from the input file), at the end of the same output file, named Lab2output.txt The following is the sample output of Lab2output.txt: 129 David P. Roselle Hall 130:Davis Marksbury Building 0633 138 Digital Village 1 139:Digital Village 2 8 Appalachian Center Anne:x 68: Boone Center 0:Bus Shelter 3 0392 87:Center for Robotics and Manufacturing Systems 101 Chem-Physics Bus Shelter 0392 225 Hilary J. Boone Center 349:Patterson office Tower 432 :Terrell Civil Engineering Building 451 Visitor Center 0568 B6 B5 0495 0633 B5 0333 D7 0014 D6 D6 0108 D7 0014 0027 D6 D6 C6 0052 D7 0032 C7 Note the first FOUR lines is the result from matching the pattern (2): buildings starting with "D" and the coordinates shown in the map are in the range of B5 to B7 (including B5, B6 and B7); and the rest part is the result from matching the pattern (3): buildings which contain "ter" as part of the building name (Ignore case distinctions) and the coordinates shown in the map are either C6 to C7, or D6 to D7 6.type the following command at the prompt $, then click "Enter" key. history |tail -10 >> Lab2output.txt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions