- OPS435 -

OPEN SYSTEM AUTOMATION

Lab #10

FOCUS: awk utility - Continued...

PART A - Perform the following tasks:

  1. Logon to your Matrix account.
  2. Perform the week11 online tutorial called "Online Linux Tutorials". This tutorial must be completed to count as half of the mark for this lab #10. The tutorial, when properly completed will send your instructor and yourself an e-mail message to verify that the tutorial was completed.

    Here is a link to the online tutorial instructions: [ html ]

  3. Proceed to Part B
  4. PART B - Perform the following tasks:

    1. Logon to your Matrix account. This lab requires that you use your Matrix account in order to submit your lab.
    2. Make an empty directory, called lab10.
    3. Use the cd command to make lab10 your present working directory.
    4. Copy and paste the contents of each of following the links (name these files in your lab10 directory the same as the link names):
      Here are the Links:

      [ produce.txt ]
      [ a1.txt ]
      [ month_end.txt ]


    5. Examine the following awk statement and examine the produce.txt file. Predict the output that awk produces.
      (Execute the statement to confirm your prediction).

      awk '/^[A-M]/ && $3 < 1 {print $1,$3}' produce.txt

    6. Examine the following awk statement and examine the produce.txt file. Predict the output that awk produces.
      (Execute the statement to confirm your prediction)

      awk '/89/{print $1,$3 * $4}' produce.txt

    7. Examine the following awk statement and examine the produce.txt file and the a1.txt file. Predict the output that awk produces.
      (Execute the statement to confirm your prediction)

      awk -f a1.txt produce.txt

    8. Examine the following awk statement and examine the produce.txt file and the month_end.txt file. Predict the output that awk produces.
      (Execute the statement to confirm your prediction)

      awk -f month_end.txt produce.txt

    9. Proceed to Part C

    PART C - Write a shell script
    1. Using vi create a file called lab10.ans and answer the following 9 questions by creating the appropriate command that would accomplish the following (number the answers 1 through 9):

      For example:
      1. answer 1...
      2. answer 2...
      etc...


      Here are the tasks:

      1. Display only the Name, Price and Quantity of each item in the db file.
      2. Display all items that cost between $0.50 and $2.15
      3. Display the name of all "Meat" products with a price of more than 2 dollars.
      4. Display the contents of the db file with the price of all taxable items discounted by 25%
      5. The Dairy industry has increased their price by 15%, show their products with the new price
      6. Lists all non-taxable items (by name) only and displays their price and their total worth (price X qty)
      7. Displays total worth of all non-taxable items
      8. Display the file with the total price, total quantity and total worth at the bottom
      9. Same as previous question but this time include a heading and display only the totals.


    2. Proceed to Part D to submit your lab...

    PART D - Submit your Lab #10:
    1. Make certain that you are currently located in the lab10 directory
    2. Issue the following Bash Shell script to check and if correct, send e-mail to your OPS435 professor (works only for Murray Saul's sections):

      /home/murray.saul/labs/submit-lab10.bash

      This shell script should either indicate problems and hints for you to correct your shell script, or indicate that your lab #10 submission was successful. If your lab was successfully submitted, both you and your OPS435 professor (Murray Saul) should have received an e-mail message.

      Note: Keep this e-mail message for the remainder of the semester as date and time stamp proof that you submitted the lab in case there is a discrepancy with your OPS435 lab grade...