Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Assignment Goals: To learn to use UNIX/Linux utilities and commands to process data in text files Tasks: 1. In your home directory, make a directory

image text in transcribed
image text in transcribed
Assignment Goals: To learn to use UNIX/Linux utilities and commands to process data in text files Tasks: 1. In your home directory, make a directory called hw2 and change the current working directory to the hw2 directony 2. Use the vi editor to create a fle named customers which contains the following text (Each line is a record of a customer including customer lD, first name, last name, and emaill- CO1 Naney: Jones:njoneseabe.eom 2 ; Barba ra ; Madison: bnadison@bed. 3 ; Tit: Adams ; t adams@ede , com CO4:Sarah: Hoore:smoore@de.com Co5:John:Polk:jpolk@efg.com CO6 Paula1Jacobs :pjacobs8igh.com 3, Use the vi editor to create a file named orders which contains the following text (Each line is a record of an order including order ID, order date, amount, and customer ID): R001:07/04/15:123.4S:co R002:12/20/15:167.50:C03 R003:03/14/16:298.00:CO6 R004:09/15/16:36.50:C03 R005:11/27/16:58.00:C02 RO06:02/28/17:72-98:CO5 4. Use the vi editor to create a script called hw2script and add the following commands into the script file: 4.1) Write commands to combine the customers and orders files and generate a file named customer order that contains customer's ID, first name, last name, email, order ID, order date, and order amount Hints: Identify a common field that appears in both files. This will be the field upon which the two files are to be joined. Sort the customers file on the common field and save the sorted result to a new file Sort the orders file on the common field and save the sorted result to a new file. Use the join command to combine the two sorted files upon the common field 2) Write a command to output the contents of the customer order file on the screen Hints: Use the echo command to output a message or an empty ine to make the output nice and 43) Sort the file customer order in the ascending order of the order amount and output the result to a fie named report 44) Write a command to output the contents of the report le on the screen. 45) Use the awk command to output from the file report the customers ID, frss name, last name, order date, and order amount in a neat format on the screen Hints: Use format specifiers such as %-10s or %12s to format the output see Chapter 4 Lecture Notes 4.6) Add a command to output 1 certify that this submission is my own original work-followed by your full name on the screen, S. Add the execute permission to the owner, group, and others for your script file 6. Run your script. The output should be similar to the sample output listed below Submission: Submit a word or pdf document that includes the following two screenshots 1. A screenshot of the contents of your script file, ie, after running the command 2. A screenshot of the output after running your script file, Le, after executing./hw2script. Vhw2script or cat hw2script Sample output after executing the script: he cuatomer order ile: 1:Nancy: Jones:njones@abe.com:RO01:07/04/15:123- 02:Barbara:Hadison:bmadisonbed.eom:R0o5:11/2/16:58.00 3:Tim: Adamstadama@ode.com: R002:12/20/15:167.50 3ITINIAdamsitadams8ode.com:R004109/15/16136.50 John: PolkijpolkBefg.COMROO6:02/20/17 72.9 06:Paula:Jacoba:pacobs8fgh.com:R003:03/14/16:298-00 he report Eile 3:Tim:Adams:tadams@ede.com:R004:09/15/16:36.50 021Bazbaza:Madison:bmadisonbod.comROOS:11/27/1658.00 CoSiJohn t Polk:polhletg.com R006:02/28/17 72-9 Nancy1 Jonesinjones8ab.COm R001107/04/151123-4 3:Tim:Adamaatadama@ode.com: R002:12/20/15:167-50 06:Paula:Jacoba:piacobs8Egh.com:R003:03/34/36:298-00 The formatced output: 09/15/16 36-50 Barbara Madi.son11/27/16 Tohn 02/28/17 07/04/1 12/20/1S 3/14/16 72-9 123-45 67-50 0 ancy 03 ones Tin Paula certify that this subnission is mny own origisal wozkYour Full Name

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