Script started on Fri Sep 28 03:30:29 2001
ws12% cat readme.txt

README

Russell J Lowke
Homework One

Files:

hello6_q1.c     // source for question one
hello6_q1       // compiled
hello6_q2.c     // source for question two
hello6_q2       // compiled
hello6_q3.c     // source question three
hello6_q3       // compiled
q4.c            // source question four
q4              // compiled
q5.c            // source question five
                // note : I realize I could have used a version of split_line
                //        to break each field into left and right but 
                          wanted to use strcpy rather than a 2d array.
q5              // compiled
q5.sh           // shell script - question five c)
q6.c            // source question six
q6              // compliled
minidb          // mini database
freshmen        // linked freshmen file

Problem 6 - question b)
Yes, I believe one could use Unix tools, I but failed to get it working properly.
'sort' would be used to align good data into patterns to be matched and removed with 'uniq'
Combinations of 'grep', 'uniq' and 'cut' would then be used to remove patterns that are known
as good data. Once all the acceptable data is shed, only the bad data will remain.

ws12% cat hello6_q1.c

#include        <stdio.h>
#include        <ctype.h>

/*
 *  hello6.c
 *
 *      purpose: shows how to examine a string char by char
 */

#define STRSIZE         100

main()
{
        int     maxnum;                 /* limit                        */
        char    message[STRSIZE];       /* an array of chars            */

        printf("Print what string? ");
        fgets(message, STRSIZE, stdin); /* read in a string             */

        maxnum = get_a_positive_number();

        repeat_a_message( message, maxnum );
}

repeat_a_message( char message[STRSIZE], int times )
/*
 * purpose: prints out the string in `message' for `times' iterations

 */
{
        int     i = 0;                      /* init local variable      */ 

        /* loop using i while < times */
        while (i < times) {
                printf( "%d. %s", i, message );         /* print it     */
                i++;
        }
}

int
get_a_positive_number()
/*
 * purpose: demand a positive integer from the user
 * returns: a positive integer
 */
{
        int     inputval = -1;
        char    inputstr[STRSIZE];

        while( inputval <= 0 )
        {
                printf("Repeat it how many times? ");   /* prompt       */
                fgets(inputstr, STRSIZE, stdin );       /* input        */
                if ( is_all_digits( inputstr ) == 0 )       /* digits?  */
                        printf("This is not a number: %s", inputstr );

                else {
                        inputval = atoi( inputstr );
                        if ( inputval <= 0 )
                                printf("%d is not positive number\n", inputval);
                }
        }
        return inputval;        /* send value back to caller */
}

int
is_all_digits( char str[STRSIZE] )
/*
 * purpose: examine a string and see if all the chars are digits
 * returns: 1 if all chars before the newline are digits, 0 otherwise
 * bug?:    what if a string with no chars appears?
 */
{
        int     pos;                    /* index into string    */

        /* loop using pos in array str looking for bad digits */
        for ( pos = 0 ; str[pos] != '\n'; pos++ ){ 
                if ( ! isdigit(str[pos]))
                        return 0;       /* found a bad digit */
        }
        return 1;                       /* no problems          */
}

ws12% cat hello6_q2.c

#include        <stdio.h>
#include        <ctype.h>

/*
 *  hello6.c
 *
 *      purpose: shows how to examine a string char by char
 */

#define STRSIZE         100

main()
{
        int     maxnum;                                 /* limit */
        char    message[STRSIZE];                       /* an array of chars */

        printf("Print what string? ");
        fgets(message, STRSIZE, stdin);                 /* read in a string  */

        maxnum = get_a_positive_number("Print how many times? ", 3);

        repeat_a_message( message, maxnum );
}

repeat_a_message( char message[STRSIZE], int times )
/*
 * purpose: prints out the string in `message' for `times' iterations
 */
{
        int     i;                                      /* local variable */

        for ( i = 0 ; i<times ; i++ )   
                printf( "%d. %s", i, message );         /* print it */
}

int
get_a_positive_number( char promptStr[STRSIZE], int maxBad) 
/*
 * purpose: demand a positive integer from the user
 * returns: a positive integer
 */
{
        int     inputval  = -1;
        int     badInputs = 0;                          /* tracks illegal inputs */
        char    inputstr[STRSIZE];

        while( inputval <= 0 )
        {
                printf("%s", promptStr);                /* prompt  */
                fgets(inputstr, STRSIZE, stdin );       /* input   */
                if ( is_all_digits( inputstr ) == 0 ) { /* digits? */
                        printf("This is not a number: %s", inputstr );
                        badInputs++;                    /* increment badInputs    */    
                        if ( badInputs > maxBad ) {     /* if too many bad inputs */
                                printf("I'm sorry, I don't understand what you said.\n" );
                                exit(1);
                        }
                }
                else {
                        inputval = atoi( inputstr );
                        if ( inputval <= 0 )
                                printf("%d is not positive number\n", inputval);
}
        }
        return inputval;                                /* send value back to caller */
}

int
is_all_digits( char str[STRSIZE] )
/*
 * purpose: examine a string and see if all the chars are digits
 * returns: 1 if all chars before the newline are digits, 0 otherwise
 * bug?:    what if a string with no chars appears?
 */
{
        int     pos;                                    /* index into string */

        pos = 0;
        while( str[pos] != '\n' ){                      /* until done   */
                if ( ! isdigit(str[pos]) )              /* if not a dig */
                        return 0;                       /* get out now! */
                pos++;                                  /* advance one  */
        }
        return 1;                                       /* no problems  */
}

ws12% cat hello6_3.c[K[K[Kq3.c

#include        <stdio.h>
#include        <ctype.h>

/*
 *  hello6.c
 *
 *      purpose: shows how to examine a string char by char
 */

#define STRSIZE         100

main()
{
        int     maxnum;                                 /* limit */
        char    message[STRSIZE];                       /* an array of chars */

        printf("Print what string? ");
        fgets(message, STRSIZE, stdin);                 /* read in a string  */

        maxnum = get_a_positive_number("Print how many times? ", 3);

        repeat_a_message( message, maxnum );
}

repeat_a_message( char message[STRSIZE], int times )
/*
 * purpose: prints out the string in `message' for `times' iterations
 */
{
        int     i;                                      /* local variable */

        for ( i = 0 ; i<times ; i++ )   
                printf( "%d. %s", i, message );         /* print it */
}

int
get_a_positive_number( char promptStr[STRSIZE], int maxBad) 
/*
 * purpose: demand a positive integer from the user
 * returns: a positive integer
 */
{
        int     inputval  = -1;
        int     badInputs = 0;                          /* tracks illegal inputs     */
        char    inputstr[STRSIZE];

        while( inputval <= 0 )
        {
                printf("%s", promptStr);                /* prompt                    */
                fgets(inputstr, STRSIZE, stdin );       /* input                     */
                if ( is_a_number( inputstr ) == 0 ) {   /* digits?                   */
                        printf("This is not a number: %s", inputstr );
                        badInputs++;                    /* increment badInputs       */ 
                        if ( badInputs > maxBad ) {     /* if too many bad inputsq2  */
                                printf("I'm sorry, I don't understand what you said.\n" );
                exit(1);
                        }
                }
                else {
                        inputval = atoi( inputstr );
                        if ( inputval <= 0 )
                                printf("%d is not positive number\n", inputval);
                }
        }
        return inputval;                                /* send value back to caller */
}

int
is_a_number( char str[STRSIZE] )
/*
 * purpose: examine a string and see if all the chars are digits
 * returns: 1 if all chars before the newline are digits, 0 otherwise
 * bug?:    what if a string with no chars appears?
 */
{
        int     pos;                                    /* index into string         */
        int     exitFlag = 0;                           /* flag for exit loop        */

        pos = 0;
        while( str[pos] != '\n' ){                      /* until done                */
                
                if ( ! isdigit(str[pos]) )              /* if not a dig              */
                        exitFlag = 1;                   /* tag exit flag             */                 
                if ( pos == 0 ) {                       /* check if first char       */
                        if ( (str[pos] == '+' || str[pos] == '-') /* is + or -       */
                              && str[pos + 1] != '\n' ) /* and subsequent char is not null */
                                exitFlag = 0;           /* clear exitFlag, it's OK   */
                }
                
                if ( exitFlag == 1 )                    /* exit flag tagged          */
                        return 0;                       /* exit now with 0           */

                pos++;                                  /* advance one               */
        }
        return 1;                                       /* no problems               */
}

ws12% cat hello6_q4.c

cat: cannot open hello6_q4.c
ws12% cat q4.c

#include        <stdio.h>
#include        <ctype.h>

/*
 *  q4.c
 *
 *      convert input file and output as printed XML
 *
 */ 

#define LINESIZE                512
#define MAXFIELDS               10
#define MAXFLDLEN               30

main()
{

        char    line[LINESIZE];                 /* an array of characters */
        char    record[MAXFIELDS][MAXFLDLEN];           
        int     studentNum       = 0;
        int     number_of_fields = 0;
        int     i, j;
        
        /* print header */
        printf("<?xml version = \"1.0\"?> \n");
        printf("<list> \n");

        /* loop through each line of data */ 
        while ( fgets( line, LINESIZE, stdin) != NULL )
        {
                /* print student header */
                studentNum++;
                printf("  <student id= \"%d\" > \n", studentNum);

                /* split line into record */
                number_of_fields = split_line( line, record );

                /* loop through each record */
                for ( i = 0 ; i < number_of_fields ; i++ ) {
                        show_field(record[i]);
                }
                
                /* print student footer */
                printf("  </student> \n", studentNum);
        }

        printf("</list> \n");

}


show_field( char theField[])
/*
 *
 * break field into left and right, then printf
 *
 */

{
        int  i;
        char c, leftSide[LINESIZE];
        int equalpos;

        /* find position of '=' */
        for ( i = 0 ; theField[i] != '=' ; i++ ) {
        }
        equalpos = i;

        /* copy left part into string and append null */
        strncpy(leftSide, theField, equalpos);  
        leftSide[equalpos] = '\0';
        
        /* print the left side */
        printf("    <%s>", leftSide);

        i++;    /* skip the '='  */

        /* print the right side (sans \n) */
        for ( ; theField[i] != '\0' ; i++ ) {
                if (theField[i] != '\n')
                        printf("%c", theField[i]);
        }
        
        /* print the left side again */
        printf("</%s>\n", leftSide);
}


int
split_line( char orig[], char fields[MAXFIELDS][MAXFLDLEN] )
/*
 * purpose: parse a line of colon-separated intms into an array of strings
 *    args: a line of colon-separted items and an array of char arrays
 *  method: loop through orig copying and copy to target array.  Change
 *          to next row at each colon
 * returns: number of fields found in line
 *    note: no error checking.  See what you can do to break it
 */
{
        int     src_pos,                /* position in source array     */
                cur_fld,                /* item in fields[] array       */
                dest_pos;               /* position in dest array       */

        src_pos = cur_fld = dest_pos = 0;

        while( 1 )
        {
                /* 
                 * if end of record, then terminate current string
                 * and advance to next row in fields[] table
                 */

                if ( orig[src_pos] == ':' || orig[src_pos] == '\0' )
                                         
                {
                        fields[cur_fld][dest_pos] = '\0';
                        cur_fld++;
                        dest_pos = 0;
                        if ( orig[src_pos] == '\0' )
                                break;
                }
                else

                /*
                 * not end of record, so copy the char from the source
                 * to the current char position in the current string
                 */
                {
                        fields[cur_fld][dest_pos] = orig[src_pos];
                        dest_pos++;
                }
                src_pos++;
        }
        return cur_fld;
}



outputXML()
/*
 * purpose: output XML version from the input 
 */
{
        int     i;                                      /* local variable */

        
        printf("    <LN> abrams</LN> \n");
        printf("    <FN> christopher</FN><CL>93</CL> \n");

}

ws12% cat q5.c

#include        <stdio.h>
#include        <ctype.h>
#include        <string.h>

/*
 *  q5.c
 *
 *      convert input file and output as:    class, last name, first name 
 *
 */ 

#define LINESIZE                512
#define MAXFIELDS               10
#define MAXFLDLEN               30

main()
{

        char    line[LINESIZE];                          /* an array of characters */
        char    record[MAXFIELDS][MAXFLDLEN];            /* the record */
        char    leftSide[LINESIZE], rightSide[LINESIZE]; /* strings for holding left and right */
        char    LN[LINESIZE],FN[LINESIZE],CL[LINESIZE];  /* strings for holding parameters */
                        
        int     i, number_of_fields;

        /* loop through each line of data */ 
        while ( fgets( line, LINESIZE, stdin) != NULL )
        {               
                /* split line into record */
                number_of_fields = split_line( line, record );

                /* clear record strings */
                LN[0] = '\0';
                FN[0] = '\0';
                CL[0] = '\0';

                
                /* loop through each record */
                for ( i = 0 ; i < number_of_fields ; i++ ) {
                        get_left(record[i], leftSide);      /* put left portion into str leftSide   */
                        get_right(record[i], rightSide);    /* put right portion into str rightSide */
                        
                        /* assign one of the three strings */
                        if (strcmp(leftSide, "LN") == 0)
                                 strcpy(LN, rightSide);
                        else if (strcmp(leftSide, "FN") == 0)
                                 strcpy(FN, rightSide);
                        else if (strcmp(leftSide, "CL") == 0)
                                 strcpy(CL, rightSide);
                }

                /* print student record */
                printf("'%s %s, %s \n", CL, LN, FN);

        }
}


int
find_equals( char theField[])
/*
 *
 * find position of the '='
 *
 */
{
        int i;

        /* loop til '=' */
        for ( i = 0 ; theField[i] != '=' ; i++ ) {
        }
        
        return i;
}

get_left( char theField[], char leftSide[])
/*
 *
 * break field into leftside
 *
 */

{
        int  equalPos;

        /* copy left part into string and append null */
        equalPos = find_equals(theField);
        strncpy(leftSide, theField, equalPos);
        leftSide[equalPos] = '\0';
        
}


get_right( char theField[],  char rightSide[])
/*
 *
 * break field into left and right, then printf
 *
 */

{
        int  i, j, equalPos;
        
        i = find_equals(theField) + 1;
        
        /* save the right side (sans \n) */
        j = 0;
        for ( ; theField[i] != '\0' ; i++ ) {
                if (theField[i] != '\n')
                        rightSide[j] = theField[i];
                j++;
        }
        rightSide[j] = '\0';
}

int
split_line( char orig[], char fields[MAXFIELDS][MAXFLDLEN] )
/*
 * purpose: parse a line of colon-separated intms into an array of strings
 *    args: a line of colon-separted items and an array of char arrays
 *  method: loop through orig copying and copy to target array.  Change
 *          to next row at each colon
 * returns: number of fields found in line
 *    note: no error checking.  See what you can do to break it
 */
{
        int     src_pos,                /* position in source array     */
                cur_fld,                /* item in fields[] array       */
                dest_pos;               /* position in dest array       */

        src_pos = cur_fld = dest_pos = 0;

        while( 1 )
        {
                /* 
                 * if end of record, then terminate current string
                 * and advance to next row in fields[] table
                 */

                if ( orig[src_pos] == ':' || orig[src_pos] == '\0' )
                                         
                {
                        fields[cur_fld][dest_pos] = '\0';
                        cur_fld++;
                        dest_pos = 0;
                        if ( orig[src_pos] == '\0' )
                                break;
                }
                else

                /*
                 * not end of record, so copy the char from the source
                 * to the current char position in the current string
                 */
                {
                        fields[cur_fld][dest_pos] = orig[src_pos];
                        dest_pos++;
                }
                src_pos++;
        }
        return cur_fld;
}


ws12% cat q5.sh

#! /bin/sh
./capitalize < freshmen | ./q5 | sort | grep -i  $1
ws12% cat q6

cat: cannot open q6
ws12% cat q6.c

#include        <stdio.h>
#include        <ctype.h>
#include        <string.h>

/*
 *  q6.c
 *
 *      convert input file and output those fields that obviously have bad data
 *
 */ 

#define LINESIZE                512
#define MAXFIELDS               10
#define MAXFLDLEN               30

main()
{

        char    line[LINESIZE];                          /* an array of characters */
        char    record[MAXFIELDS][MAXFLDLEN];            /* the record */
        char    leftSide[LINESIZE], rightSide[LINESIZE]; /* strings for holding left and right */
        char    LN[LINESIZE],FN[LINESIZE],CL[LINESIZE];  /* strings for holding parameters */
                        
        int     i, number_of_fields, badRecords;

        /* init vars */
        badRecords = 0;

        /* loop through each line of data */ 
        while ( fgets( line, LINESIZE, stdin) != NULL )
        {               
                /* split line into record */
                number_of_fields = split_line( line, record );

                /* clear record strings */
                LN[0] = '\0';
                FN[0] = '\0';
                CL[0] = '\0';

                
                /* loop through each record */
                for ( i = 0 ; i < number_of_fields ; i++ ) {

                        /* get left and right parts of field */
                        get_left(record[i], leftSide);      
                        get_right(record[i], rightSide);
                        
                        /* assign one of the three strings */
                        if (strcmp(leftSide, "LN") == 0)
                                 strcpy(LN, rightSide);
                        else if (strcmp(leftSide, "FN") == 0)
                                 strcpy(FN, rightSide);
                        else if (strcmp(leftSide, "CL") == 0)
                                 strcpy(CL, rightSide);
                }

                /* if class(CL) is not all digits
                      or a name (FN or LB) is all digits */
                if (check_string(CL, 1) ||
                    check_string(FN, 0) || 
                    check_string(LN, 0) ) {     /* found a bad record */
                
                        badRecords++;

                        /* print student record */
                        printf("'%s %s, %s \n", CL, LN, FN);
                }
        }

        /* how many bad records found? */
        printf("Bad records found: %d \n", badRecords);
}


int
check_string( char str[LINESIZE], int wantNumbers)
{
        int  i, hasLetter = 0;
        char c;
        
        /* loop through the string */
        for (i = 0; str[i] != '\0'; i++) {

                /* get this char */
                c = str[i];

                /* is it a number */
                if (c == '0' ||
                    c == '1' ||
                    c == '2' ||
                    c == '3' ||
                    c == '4' ||
                    c == '5' ||
                    c == '6' ||
                    c == '7' ||
                    c == '8' ||
                    c == '9') {
                        /* found a digit */

                        /* no name starts with a number */
                        /* '1600 Pennsylvania Ave' is not a name */

                        /* looking for names, starts with a number! */
                        if (! wantNumbers && i == 0)
                                return 1;
                }
                else {
                        /* found a non digit, tag it */
                        hasLetter = 1;
                }
        }

        /* if an empty string */ 
        if (i == 0)
                return 1;
        
        /* if looking for numbers and we found a non digit */
        if (wantNumbers && hasLetter)
                return 1;

        /* if looking for names and found only numbers */
        /* (a name like henery the 8th will be OK, it has letters & numbers) */
        if (! wantNumbers && ! hasLetter)
                return 1;

        /* string is OK */
        return 0;
}


int
find_equals( char theField[])
/*
 *
 * find position of the '='
 *
 */
{
        int i;

        /* loop til '=' */
        for ( i = 0 ; theField[i] != '=' ; i++ ) {
        }
        
        return i;
}

get_left( char theField[], char leftSide[])
/*
 *
 * break field into leftside
 *
 */

{
        int  equalPos;

        /* copy left part into string and append null */
        equalPos = find_equals(theField);
        strncpy(leftSide, theField, equalPos);
        leftSide[equalPos] = '\0';
        
}



get_right( char theField[],  char rightSide[])
/*
 *
 * break field into left and right, then printf
 *
 */

{
        int  i, j, equalPos;
        
        i = find_equals(theField) + 1;
        
        /* save the right side (sans \n) */
        j = 0;
        for ( ; theField[i] != '\0' ; i++ ) {
                if (theField[i] != '\n')
                        rightSide[j] = theField[i];
                j++;
        }
        rightSide[j] = '\0';
}


int
split_line( char orig[], char fields[MAXFIELDS][MAXFLDLEN] )
/*
 * purpose: parse a line of colon-separated intms into an array of strings
 *    args: a line of colon-separted items and an array of char arrays
 *  method: loop through orig copying and copy to target array.  Change
 *          to next row at each colon
 * returns: number of fields found in line
 *    note: no error checking.  See what you can do to break it
 */
{
        int     src_pos,                /* position in source array     */
                cur_fld,                /* item in fields[] array       */
                dest_pos;               /* position in dest array       */


        src_pos = cur_fld = dest_pos = 0;

        while( 1 )
        {
                /* 
                 * if end of record, then terminate current string
                 * and advance to next row in fields[] table
                 */

                if ( orig[src_pos] == ':' || orig[src_pos] == '\0' )
                                         
                {
                        fields[cur_fld][dest_pos] = '\0';
                        cur_fld++;
                        dest_pos = 0;
                        if ( orig[src_pos] == '\0' )
                                break;
                }
                else

                /*
                 * not end of record, so copy the char from the source
                 * to the current char position in the current string
                 */
                {
                        fields[cur_fld][dest_pos] = orig[src_pos];
                        dest_pos++;
                }
                src_pos++;
        }
        return cur_fld;
}


ws12% ./hello_q1

./hello_q1: Command not found.
ws12% ./hello6_q1

Print what string? hi there...
Repeat it how many times? 3
0. hi there...
1. hi there...
2. hi there...
ws12% ./hello6_q1[K2

Print what string? Surrender Dorathy!
Print how many times? ten
This is not a number: ten
Print how many times? eleven
This is not a number: eleven
Print how many times? twelve
This is not a number: twelve
Print how many times? thirteen
This is not a number: thirteen
I'm sorry, I don't understand what you said.
ws12% ./hello6_q2

Print what string? Big Bang
Print how many times? -4
This is not a number: -4
Print how many times? +4
This is not a number: +4
Print how many times? nine
This is not a number: nine
Print how many times? eight
This is not a number: eight
I'm sorry, I don't understand what you said.
ws12% ./hello6_q2

Print what string? Pied Piper          New Zealand
Print how many times? five
This is not a number: five
Print how many times? five
This is not a number: five
Print how many times? five
This is not a number: five
Print how many times? 5
0. New Zealand
1. New Zealand
2. New Zealand
3. New Zealand
4. New Zealand
ws12% ./hello6_q2[K3

Print what string? Australia
Print how many times? 12+
This is not a number: 12+
Print how many times? -12
-12 is not positive number
Print how many times? three
This is not a number: three
Print how many times? +12
0. Australia
1. Australia
2. Australia
3. Australia
4. Australia
5. Australia
6. Australia
7. Australia
8. Australia
9. Australia
10. Australia
11. Australia
ws12% ./hello6_q3[K[K[K[K[K[K[K[K[Kq4 < minidb

<?xml version = "1.0"?> 
<list> 
  <student id= "1" > 
    <LN>abrams</LN>
    <FN>christopher</FN>
    <CL>93</CL>
    <AD>hurlbut</AD>
  </student> 
  <student id= "2" > 
    <LN>abrons</LN>
    <FN>adam</FN>
    <CL>93</CL>
    <AD>weld</AD>
  </student> 
  <student id= "3" > 
    <LN>ackerman</LN>
    <FN>molly</FN>
    <CL>92</CL>
    <AD>eliot</AD>
  </student> 
  <student id= "4" > 
    <LN>adams</LN>
    <FN>william</FN>
    <CL>93</CL>
    <AD>holworthy</AD>
  </student> 
  <student id= "5" > 
    <LN>adler</LN>
    <FN>ellen</FN>
    <CL>93</CL>
    <AD>canaday</AD>
  </student> 
  <student id= "6" > 
    <LN>agran</LN>
    <FN>devin</FN>
    <CL>93</CL>
    <AD>canaday</AD>
  </student> 
  <student id= "7" > 
    <LN>aguirre</LN>
    <FN>richard</FN>
    <CL>93</CL>
    <AD>weld</AD>
  </student> 
  <student id= "8" > 
    <LN>ahmad</LN>
    <FN>asif</FN>
    <CL>93</CL>
    <AD>grays</AD>
  </student> 
  <student id= "9" > 
    <LN>ahmad</LN>
    <FN>muneer</FN>
    <CL>93</CL>
    <AD>canaday</AD>
  </student> 
  <student id= "10" > 
    <LN>ahumada</LN>
    <FN>leonik</FN>
    <CL>93</CL>
    <AD>pennypacker</AD>
  </student> 
  <student id= "11" > 
    <LN>aina</LN>
    <FN>abimbola</FN>
    <CL>93</CL>
    <AD>stoughton</AD>
  </student> 
  <student id= "12" > 
    <LN>aizenman</LN>
    <FN>nurith</FN>
    <CL>93</CL>
    <AD>canaday</AD>
  </student> 
  <student id= "13" > 
    <LN>akhtar</LN>
    <FN>jamiel</FN>
    <CL>93</CL>
    <AD>straus</AD>
  </student> 
  <student id= "14" > 
    <LN>alberg</LN>
    <FN>katherine</FN>
    <CL>93</CL>
    <AD>massachusetts</AD>
  </student> 
  <student id= "15" > 
    <LN>alderman</LN>
    <FN>john</FN>
    <CL>93</CL>
    <AD>wigglesworth</AD>
  </student> 
  <student id= "16" > 
    <LN>aleman</LN>
    <FN>thomas</FN>
    <CL>93</CL>
    <AD>canaday</AD>
  </student> 
  <student id= "17" > 
    <LN>ali</LN>
    <FN>tawhid</FN>
    <CL>93</CL>
    <AD>lionel</AD>
  </student> 
  <student id= "18" > 
    <LN>alldritt</LN>
    <FN>mary</FN>
    <CL>93</CL>
    <AD>straus</AD>
  </student> 
  <student id= "19" > 
    <LN>allen</LN>
    <FN>bethany</FN>
    <CL>93</CL>
    <AD>weld</AD>
  </student> 
  <student id= "20" > 
    <LN>allen</LN>
    <FN>sheila</FN>
    <CL>93</CL>
    <AD>thayer</AD>
  </student> 
  <student id= "21" > 
    <LN>alonso</LN>
    <FN>laura</FN>
    <CL>93</CL>
    <AD>straus</AD>
  </student> 
  <student id= "22" > 
    <LN>alpert</LN>
    <FN>daniel</FN>
    <CL>93</CL>
    <AD>pennypacker</AD>
  </student> 
  <student id= "23" > 
    <LN>alpert</LN>
    <FN>ivanya</FN>
    <CL>93</CL>
    <AD>thayer</AD>
  </student> 
  <student id= "24" > 
    <LN>alpert</LN>
    <FN>kayla</FN>
    <CL>93</CL>
    <AD>adams</AD>
  </student> 
  <student id= "25" > 
    <LN>alphonse</LN>
    <FN>philip</FN>
    <CL>93</CL>
    <AD>weld</AD>
  </student> 
  <student id= "26" > 
    <LN>alvarez</LN>
    <FN>cesar</FN>
    <CL>93</CL>
    <AD>wigglesworth</AD>
  </student> 
  <student id= "27" > 
    <LN>alvarez</LN>
    <FN>gloria</FN>
    <CL>93</CL>
    <AD>matthews</AD>
  </student> 
  <student id= "28" > 
    <LN>ames</LN>
    <FN>alexandra</FN>
    <CL>93</CL>
    <AD>straus</AD>
  </student> 
  <student id= "29" > 
    <LN>amestoy</LN>
    <FN>carrie</FN>
    <CL>93</CL>
    <AD>canaday</AD>
  </student> 
  <student id= "30" > 
    <LN>anderson</LN>
    <FN>carl</FN>
    <CL>93</CL>
    <AD>greenough</AD>
  </student> 
  <student id= "31" > 
    <LN>anderson</LN>
    <FN>gretchen</FN>
    <CL>93</CL>
    <AD>thayer</AD>
  </student> 
  <student id= "32" > 
    <LN>anderson</LN>
    <FN>john</FN>
    <CL>93</CL>
    <AD>matthews</AD>
  </student> 
  <student id= "33" > 
    <LN>anderson</LN>
    <FN>joshua</FN>
    <CL>93</CL>
    <AD>massachusetts</AD>
  </student> 
  <student id= "34" > 
    <LN>anderson</LN>
    <FN>valerie</FN>
    <CL>93</CL>
    <AD>grays</AD>
  </student> 
  <student id= "35" > 
    <LN>anderson</LN>
    <FN>virginia</FN>
    <CL>93</CL>
    <AD>grays</AD>
  </student> 
  <student id= "36" > 
    <LN>andrade</LN>
    <FN>anna</FN>
    <CL>93</CL>
    <AD>grays</AD>
  </student> 
  <student id= "37" > 
    <LN>andriola</LN>
    <FN>philip</FN>
    <CL>93</CL>
    <AD>greenough</AD>
  </student> 
  <student id= "38" > 
    <LN>anger</LN>
    <FN>hillary</FN>
    <CL>93</CL>
    <AD>canaday</AD>
  </student> 
  <student id= "39" > 
    <LN>ankiewicz</LN>
    <FN>kristen</FN>
    <CL>93</CL>
    <AD>matthews</AD>
  </student> 
  <student id= "40" > 
    <LN>ansari</LN>
    <FN>husamuddin</FN>
    <CL>93</CL>
    <AD>matthews</AD>
  </student> 
  <student id= "41" > 
    <LN>anthony</LN>
    <FN>ariane</FN>
    <CL>93</CL>
    <AD>thayer</AD>
  </student> 
  <student id= "42" > 
    <LN>apolinar</LN>
    <FN>mark</FN>
    <CL>93</CL>
    <AD>pennypacker</AD>
  </student> 
  <student id= "43" > 
    <LN>arias</LN>
    <FN>leticia</FN>
    <CL>93</CL>
    <AD>matthews</AD>
  </student> 
  <student id= "44" > 
    <LN>aridjis</LN>
    <FN>chloe</FN>
    <CL>93</CL>
    <AD>hollis</AD>
  </student> 
  <student id= "45" > 
    <LN>arkush</LN>
    <FN>elizabeth</FN>
    <CL>93</CL>
    <AD>holworthy</AD>
  </student> 
  <student id= "46" > 
    <LN>armstrong</LN>
    <FN>rebecca</FN>
    <CL>92</CL>
    <AD>winthrop</AD>
  </student> 
  <student id= "47" > 
    <LN>arnold</LN>
    <FN>joshua</FN>
    <CL>93</CL>
    <AD>wigglesworth</AD>
  </student> 
  <student id= "48" > 
    <LN>arnow</LN>
    <FN>joseph</FN>
    <CL>93</CL>
    <AD>weld</AD>
  </student> 
  <student id= "49" > 
    <LN>aronberg</LN>
    <FN>david</FN>
    <CL>93</CL>
    <AD>pennypacker</AD>
  </student> 
  <student id= "50" > 
    <LN>arroyo</LN>
    <FN>noemi'</FN>
    <CL>93</CL>
    <AD>hollis</AD>
  </student> 
  <student id= "51" > 
    <LN>wu</LN>
    <FN>grant</FN>
    <CL>89</CL>
    <AD>wigglesworth</AD>
  </student> 
  <student id= "52" > 
    <LN>wu</LN>
    <FN>hsi-yang</FN>
    <CL>89</CL>
    <AD>straus</AD>
  </student> 
  <student id= "53" > 
    <LN>wurtzel</LN>
    <FN>elizabeth</FN>
    <CL>89</CL>
    <AD>hurlbut</AD>
  </student> 
  <student id= "54" > 
    <LN>wyett</LN>
    <FN>christopher</FN>
    <CL>89</CL>
    <AD>holworthy</AD>
  </student> 
  <student id= "55" > 
    <LN>yamin</LN>
    <FN>katrina</FN>
    <CL>89</CL>
    <AD>wigglesworth</AD>
  </student> 
  <student id= "56" > 
    <LN>yanez</LN>
    <FN>albert</FN>
    <CL>89</CL>
    <AD>wigglesworth</AD>
  </student> 
  <student id= "57" > 
    <LN>yang</LN>
    <FN>chun</FN>
    <CL>89</CL>
    <AD>thayer</AD>
  </student> 
  <student id= "58" > 
    <LN>yang</LN>
    <FN>jeffrey</FN>
    <CL>89</CL>
    <AD>grays</AD>
  </student> 
  <student id= "59" > 
    <LN>yang</LN>
    <FN>lynn</FN>
    <CL>89</CL>
    <AD>stoughton</AD>
  </student> 
  <student id= "60" > 
    <LN>yardley</LN>
    <FN>kevin</FN>
    <CL>89</CL>
    <AD>canaday</AD>
  </student> 
  <student id= "61" > 
    <LN>yeates</LN>
    <FN>sarah</FN>
    <CL>89</CL>
    <AD>canaday</AD>
  </student> 
  <student id= "62" > 
    <LN>yen</LN>
    <FN>shawna</FN>
    <CL>89</CL>
    <AD>greenough</AD>
  </student> 
  <student id= "63" > 
    <LN>yesutis</LN>
    <FN>joseph</FN>
    <CL>89</CL>
    <AD>stoughton</AD>
  </student> 
  <student id= "64" > 
    <LN>yim</LN>
    <FN>edward</FN>
    <CL>89</CL>
    <AD>holworthy</AD>
  </student> 
  <student id= "65" > 
    <LN>yohe</LN>
    <FN>thomas</FN>
    <CL>89</CL>
    <AD>pennypacker</AD>
  </student> 
  <student id= "66" > 
    <LN>yoo</LN>
    <FN>john</FN>
    <CL>89</CL>
    <AD>weld</AD>
  </student> 
  <student id= "67" > 
    <LN>yoon</LN>
    <FN>john</FN>
    <CL>89</CL>
    <AD>matthews</AD>
  </student> 
  <student id= "68" > 
    <LN>yoon</LN>
    <FN>wahn</FN>
    <CL>89</CL>
    <AD>lionel</AD>
  </student> 
  <student id= "69" > 
    <LN>yoshino</LN>
    <FN>kaye</FN>
    <CL>89</CL>
    <AD>holworthy</AD>
  </student> 
  <student id= "70" > 
    <LN>youn</LN>
    <FN>peter</FN>
    <CL>89</CL>
    <AD>pennypacker</AD>
  </student> 
  <student id= "71" > 
    <LN>young</LN>
    <FN>hugh</FN>
    <CL>89</CL>
    <AD>wigglesworth</AD>
  </student> 
  <student id= "72" > 
    <LN>young</LN>
    <FN>reginald</FN>
    <CL>89</CL>
    <AD>straus</AD>
  </student> 
  <student id= "73" > 
    <LN>yurchak</LN>
    <FN>patricia</FN>
    <CL>89</CL>
    <AD>hollis</AD>
  </student> 
  <student id= "74" > 
    <LN>zachary</LN>
    <FN>kimon</FN>
    <CL>89</CL>
    <AD>hurlbut</AD>
  </student> 
  <student id= "75" > 
    <LN>zanft</LN>
    <FN>oksanna</FN>
    <CL>89</CL>
    <AD>canaday</AD>
  </student> 
  <student id= "76" > 
    <LN>zanft</LN>
    <FN>olivia</FN>
    <CL>89</CL>
    <AD>weld</AD>
  </student> 
  <student id= "77" > 
    <LN>zegart</LN>
    <FN>amy</FN>
    <CL>89</CL>
    <AD>straus</AD>
  </student> 
  <student id= "78" > 
    <LN>zeidenberg</LN>
    <FN>deborah</FN>
    <CL>89</CL>
    <AD>lionel</AD>
  </student> 
  <student id= "79" > 
    <LN>zelicof</LN>
    <FN>audrey</FN>
    <CL>89</CL>
    <AD>straus</AD>
  </student> 
  <student id= "80" > 
    <LN>zelman</LN>
    <FN>daniel</FN>
    <CL>89</CL>
    <AD>pennypacker</AD>
  </student> 
  <student id= "81" > 
    <LN>zens</LN>
    <FN>michael</FN>
    <CL>89</CL>
    <AD>canaday</AD>
  </student> 
  <student id= "82" > 
    <LN>zern</LN>
    <FN>jessica</FN>
    <CL>89</CL>
    <AD>#off-campus</AD>
  </student> 
  <student id= "83" > 
    <LN>zions</LN>
    <FN>bradley</FN>
    <CL>89</CL>
    <AD>#off-campus</AD>
  </student> 
  <student id= "84" > 
    <LN>zivian</LN>
    <FN>anna</FN>
    <CL>89</CL>
    <AD>hollis</AD>
  </student> 
  <student id= "85" > 
    <LN>zlupko</LN>
    <FN>george</FN>
    <CL>89</CL>
    <AD>hollis</AD>
  </student> 
  <student id= "86" > 
    <LN>zonis</LN>
    <FN>louise</FN>
    <CL>89</CL>
    <AD>wigglesworth</AD>
  </student> 
  <student id= "87" > 
    <LN>zoroufy</LN>
    <FN>darius</FN>
    <CL>89</CL>
    <AD>thayer</AD>
  </student> 
  <student id= "88" > 
    <LN>zoullas</LN>
    <FN>sophocles</FN>
    <CL>89</CL>
    <AD>wigglesworth</AD>
  </student> 
  <student id= "89" > 
    <LN>zuckerman</LN>
    <FN>daniel</FN>
    <CL>89</CL>
    <AD>thayer</AD>
  </student> 
  <student id= "90" > 
    <LN>defigueiredo</LN>
    <FN>rui</FN>
    <CL>89</CL>
    <AD>wigglesworth</AD>
  </student> 
  <student id= "91" > 
    <LN>dezengotita</LN>
    <FN>juan</FN>
    <CL>89</CL>
    <AD>wigglesworth</AD>
  </student> 
  <student id= "92" > 
    <LN>goldberg</LN>
    <FN>jeffrey</FN>
    <CL>89</CL>
    <AD>#off-campus</AD>
  </student> 
  <student id= "93" > 
    <LN>kettaneh</LN>
    <FN>reem m.</FN>
    <CL>89</CL>
    <AD>#off-campus</AD>
  </student> 
  <student id= "94" > 
    <LN>lederman</LN>
    <FN>jon</FN>
    <CL>89</CL>
    <AD>#off-campus</AD>
  </student> 
  <student id= "95" > 
    <LN>morris</LN>
    <FN>jill</FN>
    <CL>89</CL>
    <AD>#off-campus</AD>
  </student> 
  <student id= "96" > 
    <LN>roitman</LN>
    <FN>jennie</FN>
    <CL>89</CL>
    <AD>#off-campus</AD>
  </student> 
  <student id= "97" > 
    <LN>shue</LN>
    <FN>elisabeth</FN>
    <CL>89</CL>
    <AD>#off-campus</AD>
  </student> 
  <student id= "98" > 
    <LN>smith</LN>
    <FN>louisa</FN>
    <CL>89</CL>
    <AD>#off-campus</AD>
  </student> 
  <student id= "99" > 
    <LN>sosa</LN>
    <FN>e.david</FN>
    <CL>89</CL>
    <AD>#off-campus</AD>
  </student> 
  <student id= "100" > 
    <LN>frim</LN>
    <FN></FN>
    <CL>89</CL>
    <AD></AD>
  </student> 
</list> 
ws12% ./q5 < minidb

'93 abrams, christopher 
'93 abrons, adam 
'92 ackerman, molly 
'93 adams, william 
'93 adler, ellen 
'93 agran, devin 
'93 aguirre, richard 
'93 ahmad, asif 
'93 ahmad, muneer 
'93 ahumada, leonik 
'93 aina, abimbola 
'93 aizenman, nurith 
'93 akhtar, jamiel 
'93 alberg, katherine 
'93 alderman, john 
'93 aleman, thomas 
'93 ali, tawhid 
'93 alldritt, mary 
'93 allen, bethany 
'93 allen, sheila 
'93 alonso, laura 
'93 alpert, daniel 
'93 alpert, ivanya 
'93 alpert, kayla 
'93 alphonse, philip 
'93 alvarez, cesar 
'93 alvarez, gloria 
'93 ames, alexandra 
'93 amestoy, carrie 
'93 anderson, carl 
'93 anderson, gretchen 
'93 anderson, john 
'93 anderson, joshua 
'93 anderson, valerie 
'93 anderson, virginia 
'93 andrade, anna 
'93 andriola, philip 
'93 anger, hillary 
'93 ankiewicz, kristen 
'93 ansari, husamuddin 
'93 anthony, ariane 
'93 apolinar, mark 
'93 arias, leticia 
'93 aridjis, chloe 
'93 arkush, elizabeth 
'92 armstrong, rebecca 
'93 arnold, joshua 
'93 arnow, joseph 
'93 aronberg, david 
'93 arroyo, noemi' 
'89 wu, grant 
'89 wu, hsi-yang 
'89 wurtzel, elizabeth 
'89 wyett, christopher 
'89 yamin, katrina 
'89 yanez, albert 
'89 yang, chun 
'89 yang, jeffrey 
'89 yang, lynn 
'89 yardley, kevin 
'89 yeates, sarah 
'89 yen, shawna 
'89 yesutis, joseph 
'89 yim, edward 
'89 yohe, thomas 
'89 yoo, john 
'89 yoon, john 
'89 yoon, wahn 
'89 yoshino, kaye 
'89 youn, peter 
'89 young, hugh 
'89 young, reginald 
'89 yurchak, patricia 
'89 zachary, kimon 
'89 zanft, oksanna 
'89 zanft, olivia 
'89 zegart, amy 
'89 zeidenberg, deborah 
'89 zelicof, audrey 
'89 zelman, daniel 
'89 zens, michael 
'89 zern, jessica 
'89 zions, bradley 
'89 zivian, anna 
'89 zlupko, george 
'89 zonis, louise 
'89 zoroufy, darius 
'89 zoullas, sophocles 
'89 zuckerman, daniel 
'89 defigueiredo, rui 
'89 dezengotita, juan 
'89 goldberg, jeffrey 
'89 kettaneh, reem m. 
'89 lederman, jon 
'89 morris, jill 
'89 roitman, jennie 
'89 shue, elisabeth 
'89 smith, louisa 
'89 sosa, e.david 
'89 frim,  
ws12% ./q5.sh Russell

'89 Powell, Russell 
'89 Wilcox, Russell 
'90 Rothstein, Russell 
'92 Brummett, Russell 
'92 Russell, Kerstin 
'92 Russell, Paitra 
'93 Russell, Hawley 
'93 Russell, Joellen 
'93 Thompson, Russell 
ws12% ./q5.sh Jemmifer[K[K[K[K[K[Knnifer

'89 Brooks, Jennifer 
'89 Buksbaum, Jennifer 
'89 Choo, Jennifer 
'89 Cohen, Jennifer 
'89 Curtis, Jennifer 
'89 Dargan, Jennifer 
'89 Dunne, Jennifer 
'89 Greene, Jennifer 
'89 Hersch, Jennifer 
'89 Lack, Jennifer 
'89 Murphy, Jennifer 
'89 Parker, Jennifer 
'89 Samsel, Jennifer 
'89 Scanlon, Jennifer 
'89 Thompson, Jennifer 
'89 Ward, Jennifer 
'89 Weinreb, Jennifer 
'89 White, Jennifer 
'90 Bader, Jennifer 
'90 Brumage, Jennifer 
'90 Chen, Jennifer 
'90 Conner-botello, Jennifer 
'90 Copaken, Jennifer 
'90 Dodge, Jennifer 
'90 Durham, Jennifer 
'90 Frey, Jennifer 
'90 Gifford, Jennifer 
'90 Grossman, Jennifer anju 
'90 Grossman, Jennifer robin 
'90 Harris, Jennifer 
'90 Hodges, Jennifer 
'90 Holleran, Jennifer 
'90 Kennedy, Jennifer 
'90 Lee, Jennifer 
'90 Linkous, Jennifer 
'90 O'shea, Jennifer 
'90 Schuessler, Jennifer 
'90 Ting, Jennifer 
'90 Turnock, Jennifer 
'90 Walser, Jennifer 
'90 Wu, Jennifer 
'91 Bell, Jennifer 
'91 Bernstein, Jennifer 
'91 Breay, Jennifer 
'91 Call, Jennifer 
'91 Carpenter, Jennifer 
'91 Chalmers, Jennifer 
'91 Clawson, Jennifer 
'91 Cooper, Jennifer 
'91 Devore, Jennifer 
'91 Donaldson, Jennifer 
'91 Factor, Jennifer 
'91 Gable, Jennifer 
'91 Geary, Jennifer 
'91 Gilbert, Jennifer 
'91 Gonzalez, Jennifer 
'91 Griffin, Jennifer 
'91 Lebaron, Jennifer 
'91 Linden, Jennifer 
'91 Mazanec, Jennifer 
'91 Miller, Jennifer 
'91 Newstead, Jennifer 
'91 Schneider, Jennifer 
'91 Sturman, Jennifer 
'91 Vandeweghe, Jennifer 
'91 Wang, Jennifer 
'91 Weld, Jennifer 
'92 Atkinson, Jennifer 
'92 Barro, Jennifer 
'92 Boyle, Jennifer 
'92 Braunschweig, Jennifer 
'92 Brisman, Jennifer 
'92 Crimmins, Jennifer 
'92 Davidson, Jennifer 
'92 Gibbs, Jennifer 
'92 Giering, Jennifer 
'92 Haimson, Jennifer 
'92 Hertig, Jennifer 
'92 Hunter, Jennifer 
'92 Minkus, Jennifer 
'92 Motley, Jennifer 
'92 Moyer, Jennifer 
'92 Peabody, Jennifer 
'92 Ritterhouse, Jennifer 
'92 Schank, Jennifer 
'92 Shurdut, Jennifer 
'92 Smith, Jennifer 
'92 Wink, Jennifer 
'92 Zallen, Jennifer 
'93 Edelman, Jennifer 
'93 Fisher, Jennifer 
'93 Gahan, Jennifer 
'93 Guilfoyle, Jennifer 
'93 Herber, Jennifer 
'93 Klaus, Jennifer 
'93 Lee, Jennifer 
'93 Light, Jennifer 
'93 Ma, Jennifer 
'93 Mayher, Jennifer 
'93 Rohr, Jennifer 
'93 Rubell, Jennifer 
'93 Sun, Jennifer 
'93 Treadwell, Jennifer 
'93 Uphoff, Jennifer 
'93 Wisner, Jennifer 
'93 Yeh, Jennifer_j. 
'93 Yeh, Jennifer_l. 
'93 Yu, Jennifer 
ws12% ./q6 < minidb

./q6: Command not found.
ws12% ./q6[K[K[K[Kls

capitalize    freshmen      hello6.c      hello6_q1.c   hello6_q2.c   hello6_q3.c   q4            q5            q5.sh         readme.txt
capitalize.c  hello6        hello6_q1     hello6_q2     hello6_q3     minidb        q4.c          q5.c          q6.c          typescript
ws12% gcc q6.c -o q6

ws12% gcc [K[K[K./q6 < minidb

'89 frim,  
Bad records found: 1 
ws12% ./q6 < freshmen

'93g curhan, jared 
'90 lawrence,  
'90 corey,  
' barr, albert 
'89 frim,  
Bad records found: 5 
ws12% 

ws12% 

ws12% cat q5.sh

#! /bin/sh
./capitalize < freshmen | ./q5 | sort | grep -i  $1
ws12% ./q6 < minidb

'89 frim,  
Bad records found: 1 
ws12% ./q6 < freshmen

'93g curhan, jared 
'90 lawrence,  
'90 corey,  
' barr, albert 
'89 frim,  
Bad records found: 5 
ws12% exit

exit

script done on Fri Sep 28 03:40:10 2001
