> >
> > I have to mark some assignments, and I have a set of sample output and the
> > output from the students test files.
> >
> > What I need to do is compare the two files to see if they match. However I
> > cant use diff becasue a number of brain dead students added full stops to
> > the ends of lines which breaks the sample output.

         Presumably the specification for the assignment gave sample input 
and output
and a requirement to produce the output EXACTLY ?  Did you specify this ?
         Did you also provide the samples to the students in machine 
readable form ?
         If you did both the above then the result is that the students 
with the extra
full stops blew it.  Just stand upon the specification.

         Otherwise my solution is:
A) regularise the file names of the student output so that they are all the 
same length.
B) create a script which does a grep across all files looking for each 
specific pattern, the
regular expression will include all acceptable variations for that 
line.  The outputs of the greps
are all concatenated onto the same file, standard grep will put the file 
name prior to each line
Use the grep option to just count instances.
         This will give you a large file which has a line for each line 
tested in each student file.
C) Kill all lines which don't have a count of '1', counts of 0 and 2 etc 
indicate defective output.
D) sort the file
E) Use a 'uniq' option which counts number of occurrences
         The result will be a count for each student of how many lines they 
had correct.

Over the years I have often created processing pipelines like this.  Sure 
beats real programming.

Good luck


-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to