The lines in the text file summary.txt1 are formatted according to the following template:
<month> <sales in 2000> <% in 2000> <sales in 2001> <% in 2001> ... <sales in 2006> <% in 2006>
Each line contains sales figures for a product in a given month during the period 2000-2006. In addition, the file contains some comment lines that start with a hash (#). You are asked to compose a series of substitution commands that successively perform the following tasks in the text editor vi or vim. Try to use as few commands and as few characters per command as possible. Comment lines should not be affected by the substition commands. All changes should occur in succession To check for correctness you can use the files summary.$$i$$.txt (1 ≤ $$i$$ ≤ 5), that contain the content generated right after the $$i$$-th command was executed.
Replace the current field separator by a plus sign (+). Use od -c (see page 897 in the reference book) to find out what field separator sequence is used. (summary.1.txt2)
Remove all fields in which sales figures are expressed as a percentage. You must make the assumption that not all percentual sales figures contain a comma and that there is no maximum in the number of digits behind the comma. As such, the line
januari+9.733+8,47%+9.743+8,53%+9.487+8,53%+9.567+8,53%+9.687+8,38%+9.701+8,22%+10.097+8,32%
should be converted to (summary.2.txt3)
januari+9.733+9.743+9.487+9.567+9.687+9.701+10.097
Take care that notation of months is reduced to the first three letters in the name of the month, and make explicitly clear that each line represent sales figures from the decennium 2000. As an example, the line
januari+9.733+9.743+9.487+9.567+9.687+9.701+10.097
must be substituted by the line (summary.3.txt4)
jan/200*+9.733+9.743+9.487+9.567+9.687+9.701+10.097
Mark those months in which the product was sold in more or less the same amounts over the years (meaning that the sales figures have the same thousands). This should be done by appending an extra field that contains the value STABIEL (stable in Dutch) to those lines that fulfill the above condition. For example, in December the product was sold each year between 9000 and 9999 times, so this is a stable month. In contrast, the month May is unstable as sales figures in 2000 and 2006 are quite a bit higher compared to other years. As such, the line
dec/200*+9.084+9.133+9.214+9.552+9.946+9.820+9.556
omgezet naar (summary.4.txt5)
dec/200*+9.084+9.133+9.214+9.552+9.946+9.820+9.556+STABIEL
As a means of protecting against the competition you are asked to scramble the data. Do this by replacing each digit by its (reversely) matching position in the alphabet (0 becomes z, ... , and 9 becomes q) and by placing the data for each year on a separate line. This way the line for december, for example, is converted to the following series of lines: (summary.5.txt6)
dec/xzz*+q.zrv+ dec/xzz*+q.yww+ dec/xzz*+q.xyv+ dec/xzz*+q.uux+ dec/xzz*+q.qvt+ dec/xzz*+q.rxz+ dec/xzz*+q.uut+STABIEL
Every line here matches one year. The first line represents the sales numbers for 2000, and the last represents those for 2006. It's possible you will have to provide multiple commands in order to do this.
Carefully follow the instructions below when submitting a solution:
Put your commands for the five parts of this assignment in the designated positions.
Refrain from making any changes to the lines already filled in in the submission area. These are used to parse the submitted solutions into separate partial solutions. You can check whether or not the parsing was successful on the feedback page.