Construct gawk commands to operate on an Credit card charges of John Smith, Esq., from Blacksburg, VA that will produce results specified below. Write down your awk commands below each question or use a separate sheet if you need space. If you need, you can use multiple gawk scripts connected with pipes | . Try not to, but if absolutely unavoidable, you can also use egrep . If more than one script is used, make sure to give the whole sequence in your answer. Note that not every dollar amount reported is the money SPENT. Also note that not every line that has $ sign should count - only those lines that start with a date are what you need.
1: The price is not always in the same field if you use a tab delimiter. The two lines containing "FOREIGN CURRENCY" are different than the rest.
2: You can't use the escape character \ inside of "", gawk will complain.
1: It was asked that you print the lines sorted by dollar amount. Many either did not do this at all or did not sort by dollar amount.
2: The total spending by Jan 26th inclusive means everything spent before and on Jan 26th. There was some confusion on interpretation.
1: Wilco is a gas station as well, many of you did not include this. However, since it was not obvious Wilco is a gas station, no points were taken off for this.
2: Same mistakes as problem 1.
1: The problem asked for all charges that were 50% of total spending AND outside of the US, not OR. A charge must match both conditions to cause a warning.
2: A clean solution should compute the total on the fly. One point was taken off for using a precomputed solution.
3: Calculating the total on the same pass through the file that you are checking for 50% of total spending is incorrect. You will not have the total spending untill you make a complete pass through the file.
1: Percentage of total spending means (total dollars in home state)/(total dollars) * 100.
2: Again, do not use a precomputed total. It should be done on the fly.
1: The correct interpretations of balance are:
Balance = total spent - payments made OR
Balance = payments made - total spent.