Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

THIS IS ONE QUESTION. IF YOU START IT, COMPLETE a-o PARTS. IF YOU DONT COMPLETE IT, YOUR ANSWER WILL BE REPORTED! The following table is

THIS IS ONE QUESTION. IF YOU START IT, COMPLETE a-o PARTS. IF YOU DONT COMPLETE IT, YOUR ANSWER WILL BE REPORTED!

The following table is from Wikipedia. It shows the eleven highest mountains in Georgia.

image text in transcribed

a) Use grep to print all lines where the mountains are at Towns or Union County.

b) Use wc and grep to count the number of mountains located at Rabun County. Hint: please use pipe |

c) Finish task b) by using only grep. Hint: open the manual page of grep, and check -c option.

d) A. Type command sed s/ridge high point/r.h.p./p mountainList.txt and execute it.

B. Type command sed -n s/ridge high point/r.h.p./p mountainList.txtand execute it.

C. Open the manual page of sed and describe what does n do in sed?

D. Describe what does the sed command in (B) do?

e) Use sed to remove the leading spaces in "mountainList.txt" and print out the processed lines.

f) Finish task e) and save the output to file "newList.txt".

g) Use sed to list the lines beginning with white spaces in "mountainList.txt".

h)Use sed to delete the lines where the mountains are only at Union County in "mountainList.txt".

i) Use sed to remove the middle three fields in each line of "mountainList.txt". Hint: Think about the meaning of regex '[^,]'

j) Use awk to finish task i)

k) Use sed to insert a new line Table: Eleven highest mountains in Georgia at the beginning of "mountainList.txt".

l) Use sort to print out the sorted lines in alphabetical order according to the names of mountains.

m) Use sort to print out the sorted lines in descending order according to the height of mountains.

n) When a pattern groups all or part of its content into a pair of parentheses, it captures that content and stores it temporarily in memory. You can reuse that content if you wish by using a back-reference, in the form: or $1, where or $1 reference the first captured group (Refer to [1]). For example, the following command add a colon between Union and County. sed -E s/(Union)s(County)/:/g mountainList.txt

o) Now can you write a command to finish task 9) using sed with back- reference?

Brasstown Bald, (summit),4784,feet,Union County Rabun Bald, (summit),4696,feet,Rabun County Dick's Knob, (summit),4620,feet,Rabun County Hightower Bald, (summit),4568,feet,Towns County Wolfpen Ridge, (ridge high point),4561,feet,Towns and Union Counties Blood Mountain, (summit),4458,feet,Union County Tray Mountain, (summit), 4430,feet,Towns County Grassy Ridge, (ridge high point),4420,feet,Rabun County Slaughter Mountain, (summit),4338,feet,Union County Double Spring Knob, (summit),4280,feet,Rabun County Coosa Bald, (summit),4280,feet,Union County

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions