Open your terminal and connect to snowball server. Change your directory to your
ID: 3754216 • Letter: O
Question
Open your terminal and connect to snowball server. Change your directory to your home directory (od and then create a new directory named as Tabe (mkdir Lab4) After that, go to directory Lab4 (od Lab4) and please download a file contalning the content in the above table by the following command (Internet access required) Be sure it succeeds using "ls" to see the file name "CompanyList.txt* listed. Please complete the following tasks and answering corresponding questions step by step. No screenshot is needed unless specified. 1) Type command grep-color -n 'Atlanta CompanyListtxt and execute it. Then please 2) Type command grep-color n Atilantaline CompanyList.txt and execute it. Then please describe what does this grep command do? 3) Type command egrep-color -n 'Atlantajlne CompanylListtxt and execute it. Then 4) Write the command to count the number of Incorporations ("inc or "incorporated") 5) located at Atlanta by checking file CompanyList.txt. (Hint: use Pipe T and we) Type command sed -n /soft drinks/p CompanyList.txt and execute it. 6) Use sed to remove the last two lines in in Company List.t 7) Use sed to remove the companies at Atlanta in CompanyList.tat 8) Use sed to replace the last two lines by a new line "Above are the top 10 companies in GA Use sed to insert a new line Fortune 500 companies in GA" at beginning of file. after deletion, the output for line number 1 should become "1.The Home Depot (Ranked 9) 10) Use sed to remove the business industry and location for each company For example, 11) Use sed to list only the company name on esch line by checking in Compurylistcnt 12) Replace the period right after the line number by a colon on each line and save the 28)" where the colon after (Ranked 28) should also be removed Eg line 1 in the output is The Home Depot Eg line 12 in the output is Motiawk Industries lnc output to a new file "newCompanyList.txtExplanation / Answer
1. 35 (I downloaded the file online your results might varry. but please note it will be shwoing line number so you can get this easily)
2. This command is finding all lines in the file which has Atlanta in it.
$ grep --color -n 'Atlanta' CompanyList.txt
1:1.The Home Depot (Ranked 28): The worldu2019s largest home improvement retailer; headquartered in Atlanta, GA.
3:2.United Parcel Service (UPS) (Ranked 48): One of the countryu2019s largest shipping companies; headquartered in Atlanta, GA.
5:3.The Coca-Cola Company (Ranked 62): The engine behind one of the world's favorite soft drinks; headquartered in Atlanta, GA.
7:4.Delta Air Lines, Inc. (Ranked 68): The world's largest airline; headquartered in Atlanta, GA.
11:6.The Southern Company (Ranked 162): Regional energy company focused in the Southeast; headquartered in Atlanta, GA.
13:7.Genuine Parts Company (Ranked 183): A service organization engaged in the distribution of automotive and industrial replacement parts, office products and electrical materials; headquartered in Atlanta, GA.
15:8.First Data Corporation (Ranked 249): A global payment processing company; headquartered in Atlanta, GA.
19:10. HD Supply Holdings, Inc. (Ranked 320): One of the largest industrial distributors in North America; headquartered in Atlanta, GA.
21:11.Suntrust Banks, Inc. (Ranked 329): Banking, lending, investing and insurance solutions; headquartered in Atlanta, GA.
29:15.Coca-Cola European Partners, PLC (Ranked 397): A drink company that markets, produces and distributes nonalcoholic beverages; headquartered in Atlanta, GA.
33:17.Pultegroup, Inc. (Ranked 433): A multi-brand eco-friendly homebuilding company; headquartered in Atlanta, GA.
35:18.Newell Rubbermaid Inc. (Ranked 434): A worldwide marketer offering home organization products; headquartered in Atlanta, GA.
3. $ grep --color -n 'Atlanta|Norcross' CompanyList.txt
This command is trying to find string 'Atlanta|Norcross' in CompanyList.txt which is not present.
4. This command is greping for all lines which has either Atlanta or Norcross in it.
$ egrep --color -n 'Atlanta|Norcross' CompanyList.txt
1:1.The Home Depot (Ranked 28): The worldu2019s largest home improvement retailer; headquartered in Atlanta, GA.
3:2.United Parcel Service (UPS) (Ranked 48): One of the countryu2019s largest shipping companies; headquartered in Atlanta, GA.
5:3.The Coca-Cola Company (Ranked 62): The engine behind one of the world's favorite soft drinks; headquartered in Atlanta, GA.
7:4.Delta Air Lines, Inc. (Ranked 68): The world's largest airline; headquartered in Atlanta, GA.
11:6.The Southern Company (Ranked 162): Regional energy company focused in the Southeast; headquartered in Atlanta, GA.
13:7.Genuine Parts Company (Ranked 183): A service organization engaged in the distribution of automotive and industrial replacement parts, office products and electrical materials; headquartered in Atlanta, GA.
15:8.First Data Corporation (Ranked 249): A global payment processing company; headquartered in Atlanta, GA.
17:9. WestRock (Ranked 251): One of North Americau2019s leading manufacturers of corrugated and consumer packaging; headquartered in Norcross, GA.
19:10. HD Supply Holdings, Inc. (Ranked 320): One of the largest industrial distributors in North America; headquartered in Atlanta, GA.
21:11.Suntrust Banks, Inc. (Ranked 329): Banking, lending, investing and insurance solutions; headquartered in Atlanta, GA.
29:15.Coca-Cola European Partners, PLC (Ranked 397): A drink company that markets, produces and distributes nonalcoholic beverages; headquartered in Atlanta, GA.
33:17.Pultegroup, Inc. (Ranked 433): A multi-brand eco-friendly homebuilding company; headquartered in Atlanta, GA.
35:18.Newell Rubbermaid Inc. (Ranked 434): A worldwide marketer offering home organization products; headquartered in Atlanta, GA.
5. 13. This is obtained by pipeing result to wc command with an option -l to count lines in output.
$ egrep --color -n 'Atlanta|Norcross' CompanyList.txt|wc -l
13
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.