On Nov 18, 4:03 pm, "ela" <e...@yantai.org> wrote:
> after man diff, it seems that I cannot generate the 2 output files simply > from files a & b?
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
...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.
ela wrote: > 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.
> ela wrote: >> 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
>>> 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.
>>> 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