[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Comparing files in two directories



L.V.Gandhi wrote:
I have two directories A and B. In each directory, I have nearly 1000 files with same names. I would like to compare both directories and find out which files differ more than say 5 lines. I use kompare and see manually. How to do it in command line easily?

Here's a scriptlet that will print the name of all the files for
which diff produces more than 5 lines of output.  (Which is not quite
to say that they differ in 5 lines, but it's close).

for file in $(find A -type f); do if test $(diff $file B/${file/A/} | wc -l) -gt 5; then echo $file; fi; done



Reply to: