Re: diff files matching a pattern



Kamaraju S Kusumanchi wrote:
Let's say I have two directories dir1, dir2 each with 1000 files.
Of these 1000 files in each directory, there are 50 files named file1.txt,
file2.txt ... file50.txt. The rest of the files do not follow any pattern
and are very large in size.

Now is there any way to compare

dir1/file1.txt and dir2/file1.txt
dir1/file2.txt and dir2/file2.txt
....
dir1/file50.txt and dir2/file50.txt


Manually diffing the files 50 times is cumbersome. Something like

diff dir1/file*.txt dir2/file*.txt

is what I am after. I do not want to do

diff -r dir1 dir2

since that compares the other 950 files as well besides the 50 files that I
want. Any idea how to achieve this in the most generic fashion? Has anyone
done this kind of thing before?

thanks
raju
for i in `seq 1 50`; do diff dir1/file$i.txt dir2/file$i.txt > diff$i.txt ; done

For details on for, se man bash.

--
He had occasional flashes of silence that made his conversation perfectly
delightful.
-- Sydney Smith

Eduardo M KALINOWSKI
ekalin@xxxxxxxxx
http://move.to/hpkb


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: diff files matching a pattern
    ... On Sunday 24 February 2008 02:21 pm, Kamaraju S Kusumanchi wrote: ... Now is there any way to compare ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Delay when typing in konsole
    ... On Mon, Apr 28, 2008 at 11:49 PM, Kamaraju S Kusumanchi ... What version of konsole? ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: configure error: C compiler cannot create executables
    ... On Sun, Mar 30, 2008 at 9:24 AM, Kamaraju S Kusumanchi ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ... Trouble? ...
    (Debian-User)
  • Re: [OFF-TOPIC] Mailing List Netiquette
    ... to post on debian-user" by Kamaraju S Kusumanchi: ... Learning to quote should include trimming from the quote all the material that is not relevant to your answer. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)
  • [debian-user] The List Standard
    ... Kamaraju S Kusumanchi ... AFAIK Thunderbird can thread even if the subject is changed. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)