file a:
1 2 3
1 1 1
file b:
1 1 1
1 3 9
2 2
OutputSame:
1 1 1
OutputDiff:
file a 1 2 3
file b 1 3 9
file b 2 2
I'm not sure I understand what you mean, but if you want to do a
comparison without regard to where lines appear in each file (which
seems to be what you want), you could probably use the `comm` command.
For example, to get lines that are common to both files, you might try
something like:
bash$ comm -12 <(sort a) <(sort b)
1 1 1
...or to get lines that are not common to both files:
bash$ comm -13 <(sort a) <(sort b); comm -23 <(sort a) <(sortb)
1 3 9
2 2
1 2 3
I hope that helps.
-- Pete
bash$ comm -12 <(sort a) <(sort b)
1 1 1
...or to get lines that are not common to both files:
bash$ comm -13 <(sort a) <(sort b); comm -23 <(sort a) <(sortb)
1 3 9
2 2
1 2 3
I hope that helps.
-- Pete
When files a & b both contain the following line,
11821 0 -2 ?->-
comm can't recognize it to be the same. Is there something dealing with the
<( ) and sort mentioned by you? Because I omitted them, which otherwise
caused execution error.
Is the whitespace identical ? Trying checking with a hex editor, or cat -evT
or similar.
The text is generated by program and therefore should not have typo or any
manmade errors. Another point I'm thinking about is whether ? or > alike are
reserved words that drive comm crazy
Did you check?
BugBear
if yur problem is related to patches, i suggest you take a look at
vsrpatch (Versus patches):
http://www.solaris-fr.org/home/contribs/sys/vrspatch_en
diff is perfectly fine for you.
$ diff --unified=1000 "file a" "file b" | egrep -v "\-\-|\+\+|@@"
| sed -e 's/-/file a /;s/+/file b /;s/^ /file a+b /'
file a 1 2 3
file a+b 1 1 1