+ 1

This is a unix question

I .)using the data file provided (delimited by a space or tab) named assignl .input January 700 Apri1300 August 200 February 300 May 500 December 400 2.) write a script that will use AWK to process the data file line by line and format as shown. It must sort the months. Month. Sales January 700 February 300 Apri1300 May 500 August 200 December 400 Total show the total

10th Jun 2018, 11:38 AM
Julie Ann
Julie Ann - avatar
1 Odpowiedź
+ 4
$ cat myawk.sh #!/bin/bash FILE=myfile.in AWKSCRIPT=myscript.awk echo "January 700 April 300 August 200 February 300 May 500 December 400" > $FILE echo 'BEGIN {sales=0} NF == 2 {s+=$2} END {print "Total " s} ' > $AWKSCRIPT LOCALE=$LANG LANG=en_US.UTF-8 echo "Month Sales" sort -k 1M $FILE awk -f $AWKSCRIPT $FILE LANG=$LOCALE $chmod 755 myawk.sh $./myawk.sh Month Sales January 700 February 300 April 300 May 500 August 200 December 400 Total 2400 $
10th Jun 2018, 11:29 PM
Dmitriy
Dmitriy - avatar