On Tue, 12 Feb 2002, Jason Rennie wrote: > Hi all, > > I've found the option in grep to take in a file as a list of expressions. > > Is it possible to get grep to perform a logical and operation on the > patterns in the file rather than an or ? > > 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. > > So now I am reduced to doing a grep on the files to check if the lines in > one are contained in the lines of the other. > > Is this possible with grep's -f option ? > > Is there a better solution ?
How about a 2 step process. Use sed to remove trailing full stops on the lines then use diff? diff sample.output `sed -e "s/\.$//" student.output` Actually I just tried that and diff has trouble coping so write to a file first. -- ---<GRiP>--- Web: www.arcadia.au.com/gripz Answering Machine/fax: 02 4950 1194 (wait 5 mins if no answer) Mobile: 0408 686 201 -- SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
