Homework 1, Capture the File.

Short Description:

Copy files from your instructor's directory, modify these files, submit the results.

This assignment is worth 5 points.

Goals

When you finish this homework, you should: The main goal of this assignment is to get you back working in the linux environment, with all of the tools needed to do your homework. If you experience any difficulties, or need further assistance, PLEASE ASK.

Formal Description

The directory ~dbennett/230/hw1 contains a solution to a simple assignment.

Assignment 0: Do some stats.

The user has a number of files containing either integer or floating point data. The user would like to perform statistics on these files, but would like to do so in batch.

The program should read a file called files.in, which contains the names of all of data files, one per line. For each file name, open and process the associated data file.

Each data file will contain meta-data describing how to process the file. This meta-data consists of a string, either integer or real. This is followed by an integer representing the number of spaces for output, and in the case of real, it is also followed by an integer giving the precision for output. Immediately following the meta-data is the data, a series of number of the type named by the string.

Your program should read in the numeric data, and print it back out using the specified width and precision. It should also count the number of input data values and compute the sum and the average of these input values, which it should also print.

You may assume valid data with no errors.

Your task is threefold.

  1. Copy these files to your directory
  2. Modify both the code and the data files.
  3. Submit your work via email to your instructor as a tar file.

Copying Files

Throughout the semester I will write code which I will make available in my directory on the CS domain. You need to be able to access and copy these files. Part of the purpose of this assignment is to make sure that you can copy files.

    Copy the files from ~dbennett/230/hw1 into your directory structure so that you may modify them. You should place these files in a new sub directory.
  1. The source directory is ~dbennett/230/hw1. There are five files in this directory,
  2. You can list these files by typing
    ls ~dbennett/230/hw1
    
  3. You can copy a.dat to your current directory by typing
    cp ~dbennett/230/hw1/a.dat .
    
    Note that command ends in a . which you must type.

  4. You can copy the entire directory to your directory by typing
    cp -r ~dbennett/230/hw1 . 
    
    This will create a new directory called hw1 in your current directory

  5. There are other possibilities, if you want to do something different just ask.

Modifying Files

A second purpose of this assignment is to make sure you can perform all steps of the edit-compile-execute cycle. Remember, a text editor can manipulate code or data files.

Submitting Files

There are several ways to do this, but I would like you to use the TAR program. To create a TAR file of the directory hw1

Required Files

The modified files compressed into a tar file.

Submission

Email your tar file as an attachment to dbennett@edinboro.edu. Make sure that the title indicates that this is homework1 and that your name and section are included in the body of the message.