lundi 27 avril 2015

how do i compare two script files, where one file is input and another is a reference file?

i have two scripts, one is input file and another is reference file and i want to compare whether the input file is valid or not using the reference file.

I want to compare the content of the reference file with the input file and check if input is valid or no, but the input file may contain strings which are valid but if i compare whether exact string is present in the input file or no, OR if the reference string is a part of the input file, then the output will give error.

Ex:

reference file may contain the following commands:

-rpm -i *.rpm >> /tmp/logfile.log

-rpm -i *.rpm

and the input file may contain :

-rpm -rpm -ivh *.rpm -rpm -i >> /logfile.log

i am using python 2.4.

So, how can i compare them and tell if input string is valid or no?




Aucun commentaire:

Enregistrer un commentaire