Computing.Net > Forums > Unix > Comparing multiple files using diff

Comparing multiple files using diff

Reply to Message Icon

Original Message
Name: bengalliboy
Date: August 19, 2004 at 13:47:31 Pacific
Subject: Comparing multiple files using diff
OS: UNIX
CPU/Ram: 450
Comment:

I am comparing two files fine using diff as follows and manipulating the results:
diff FileA FileB | sort -u > result
How do I do the same for a sets of file some thing like this:
comapare set of File A with File A'
and File B with File B'
and have the result onto a file.
So,
Looking for some thing:
add the result of 'diff fileA fileA' with
'diff FileB FileB' and so on and sort and get unique records...

Should I use a pipe/cat ? Or an Array ? Note, I need to several sets comparison. So I am looking on efficiency.

TIA


Report Offensive Message For Removal

Response Number 1
Name: Jake2
Date: August 23, 2004 at 19:34:07 Pacific
Subject: Comparing multiple files using diff
Reply: (edit)

I would put A, B... in directory1 and A', B'... in directory2 but with the same names used in directory1 (A, B...), then run "diff -u directory1 directory2".

Other interesting options for diff are -N for new files, -a for forcing ASCII, and -r for recursing subdirectories. For example, I use "diff -Nuar dir1 dir2" for Linux kernel trees.


Report Offensive Follow Up For Removal

Response Number 2
Name: h4x3r
Date: August 24, 2004 at 10:29:42 Pacific
Subject: Comparing multiple files using diff
Reply: (edit)

cant you just redirect output using >>


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Comparing multiple files using diff

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software