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

Re: diff files matching a pattern



Eduardo M KALINOWSKI wrote:

>>
>> 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
> 

Ok, this works on the command line. But I am looking for something along the
lines of

bash_script_name dir1/pattern1 dir2/pattern2


where dir1/pattern1, dir2/pattern2 are given as arguments to the script. I
could not figure out how to do this inside a bash script. Any idea?

raju

-- 
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/


Reply to: