Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

this is a unix question. 1.)using the data file provided (delimited by a space o

ID: 3902883 • Letter: T

Question

this is a unix question.

1.)using the data file provided (delimited by a space or tab) named assign1.input

January 700
April 300
August 200
February 300
May 500
December 400

2.) write a script that will use AWK to process the data file line by line. I need the scrip to sort the months then send the output to assign2.input in the following format.
Month.         Sales
_____         ___


January        700
February      300
April             300
May              500
August          200
December    400
-----

Total           show the total

Explanation / Answer

Following is the answer:

awk 'BEGIN { print "Month. Sales"

print "----- ------" }

{ print $1, $2 }

{ SUM += $2 } END { print "----- Total " SUM }' sh1.txt >> cat1.txt