CS010 Week 4 Assignment

Processing Data with Shell Scripts

Due: January 26, 2001, 10 AM

This assignment should be turned in for evaluation. To turn in the assignment, you will use the turnin command:

turnin -c 010 assign4.sh

You may turn in the same file more than once. This will overwrite the earlier version. You may want to do this if you discover a mistake or make an improvement after turning in your assignment.

Your task is to write a bash script, called assign4.sh, to extract information from a collection of data files and write the extracted information into a single file. Specifically, you are given a collection of files with names of the form a-b-c-d-e.dat, where a, b, c, d, and e are the parameters of the program which generated each data file. These files contain timings for various parts of a program. Each line contains a character string followed by a number optionally followed by additional information which we will ignore. The character string is a tag which specifies what part of the program is being timed, and the first number following the tag is the time in seconds for that part of the program.

Your script should take one command-line argument which is the tag specifying one of the parts of the program from the data files. The script should create a file tag.out, where tag is replaced with the actual tag provided on the command line. This file should contain lines with each of the five parameters (a,b,c,d,e) from the data file name for each timing, followed by the time from the data file.

The actual data files are in /shared/terescoj/shared/cs010/assign4 and an example output file INIT.out is there as well. You can see from the filenames that the value of a can be 2 or 3, b and c can be 0, 1, 2, 3, 4, or 5, d can be 0.0 or 0.15, and e can be 0, 1, or 2. However, not all combinations exist.

Your script may use any of the Unix tools we have discussed, but you should not write any C code for this project.