Shell script to compare that given two files are same or not, Programming Languages

W.A.S.S to compare that given two files are same or not. If found same then delete the second file.

  echo -e "Enter the 1st File name : \c"

read ffname

echo -e "Enter the 2nd File name : \c"

read sfname

res=`cmp $ffname $sfname|wc -l`

//cmp is used for comparing two files and return where those are different

if [ $res -eq 1 ]

then

         echo "Both files are not same"

else

         echo "Both files are same"

         rm $sfname

fi

 

Output

sh  compare.sh

 

Enter the 1st File name : t1.txt

Enter the 2nd File name : t2.txt

Both files are same

 

Posted Date: 9/26/2012 8:17:05 AM | Location : United States







Related Discussions:- Shell script to compare that given two files are same or not, Assignment Help, Ask Question on Shell script to compare that given two files are same or not, Get Answer, Expert's Help, Shell script to compare that given two files are same or not Discussions

Write discussion on Shell script to compare that given two files are same or not
Your posts are moderated
Related Questions
XML Publishing. Consider the following relational data: Products: pid Name Price Description 323 gizmo

the details on the two pictures on the link below : http://rak-up.com/up/files/18637.jpg ">http://rak-up.com/up/files/18636.jpg http://rak-up.com/up/files/18637.jpg

Pseudo code the shows logic for a program that generates a random number, then ask the user to think of a number between 1 and 10

1 Triple Eigenvalue with 2 Linearly Independent Eigenvectors       In this case we will have the eigen-value l with the two linearly independent eigenvectors  ?h 1 and  ?h 2

1 Real and 2 Complex Eigenvalues    From the real eigenvalue/vector pair, l 1 and ?h 1 e l1 t ?h 1 We find the other two solutions in identical manner which we did

Eclipse Jsp Project. I am making a a project on my website and i was making a help support page on which the user can submit their question and the question is saved to a text file

Write a python script that will take two file names as input (src, dest). Open src reading each line in the file, and replacing any occurrences of name with the string "redacted".

a program that enter an alphabet from the user and compare it is vowel or not?

I need to finish my game project within two weeks using XNA. Would you guys can help me to finish it? Thank you

non restoring division