Re: Comparing files in two directories
On 6/14/07, William Pursell <bill.pursell@gmail.com> wrote:
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
Can you please explain both $ part?
--
L.V.Gandhi
http://lvgandhi.tripod.com/
linux user No.205042
Reply to: