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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Comparing multiple files using diff

Reply to Message Icon

Name: bengalliboy
Date: August 19, 2004 at 13:47:31 Pacific
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



Sponsored Link
Ads by Google

Response Number 1
Name: Jake2
Date: August 23, 2004 at 19:34:07 Pacific
Reply:

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.


0

Response Number 2
Name: h4x3r
Date: August 24, 2004 at 10:29:42 Pacific
Reply:

cant you just redirect output using >>


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


concat strings and keep s... Older harddrive. Where's ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Comparing multiple files using diff

compare two files and diff file wil www.computing.net/answers/unix/compare-two-files-and-diff-file-wil/7363.html

Combine multiple files using awk www.computing.net/answers/unix/combine-multiple-files-using-awk/7591.html

Comparing 2 files www.computing.net/answers/unix/comparing-2-files/7690.html