Answered step by step
Verified Expert Solution
Question
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
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 directory 2. Use the vi editor to create a file named customers which contains the following text (Each line is a record of a customer including customer ID, first name, last name, and email) Co1:Nancy: Jones:njones abc.com CO2: Barbara:Madison:bmadison@bed.com CO3: Tim: Adams: tadams@cde. com C04:Sarah :Moore:smoore@def.com Co5:John: Polk Jpolkeefg.com CO6 Paula:Jacobs:pjacobsefgh.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) RO01:07/04/15:123.45:C01 RO02:12/20/15:167.50:C03 R003:03/14/16:298.00:C06 R004:09/15/16:36.50:CO3 RO05 11/27/16:58.00:C02 RO06:02/28/17:72.98:C05 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 4.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 line to make the output nice and readable 4.3) Sort the file customer_order in the ascending order of the order amount and output the result to a file named report. 4.4) Write a command to output the contents of the report file on the screen. 4.5) Use the awk command to output from the file report the customer's ID, first name, last name, order date, and order amount in a neat format on the screen. Hints: Use format specifiers such as %-10s or 9612s to format the output. See Chapter 4 Lecture Notes. 4.6) Add a command to output I certify that this submission is my own original work - followed by your full name on the screen. 5. 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 Sample output after executing the script: 1estudent@farvlu hw29 /hw2acript The customer order file CO1:Nancy: Jonesinjones@aba.com:ROOL:07/04/15:123-45 CO2 :Barbara :Madison:bmadison@bad.com:ROOS:L1/27/16:58.00 CO3 :Tim:Adamsitadams@ade,com:Ro02:12/20/15:167.50 CO3 :Tim:Adamsstadams@ade,com:RO04:09/15/16:36.50 COS :John: Polk:3polk efg.com:RO06:02/28/17 72.98 CO6:Paula:Jacobsipjacobs@fgh.com:ROO03:03/14/16:298.00 The report file CO3:Tim:Adamsitadams@ade.com:RO04:09/15/16:36.50 CO2 :Barbara:Madison:bmadison bed.com:R00S:11/27/16:58.00 COS :John: Polk:ipolk efg.com:RO06:02/20/17:72.98 01:Nancy Jonesinjones@abe.com:ROO1:07/04/15:123.45 CO3 :Tim:Adamsstadams@ade.com:R002:12/20/15:167 50 06:Paula:Jacobs:pjacobs@fgh.com:ROO3:03/14/16:298.00 The formatted output C02 CO5 Tim Barbara John Naney Adams Madison Polk Jones Adams Jacobs 09/15/16 11/27/16 02/28/17 07/04/15 12/20/15 03/14/16 36.50 58.00 72.98 123.45 167.50 298.00 3Tim Co6 Paula
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started