I am using diff to find the differences between two text file. It was working great but, when I change the order of lines in the text files, it show the similar text in the result file.
Here is file1.txt:
>gi17
AAAAAA
>gi30
BBBBBB
>gi40
CCCCCC
>gi92
DDDDDD
>gi50
EEEEEE
>gi81
FFFFFF
File2.txt
>gi40
CCCCCC
>gi01
BBBBBB
>gi02
AAAAAA
>gi30
BBBBBB
Result.txt:
>gi17
AAAAAA
>gi30 ???
BBBBBB ???
>gi92
DDDDDD
>gi01
BBBBBB
>gi50
EEEEEE
>gi81
FFFFFF
>gi02
AAAAAA
>gi30 ???
BBBBBB ???
Diff statement:
$ diff C:/Users/User/Desktop/File1.txt C:/Users/User/Desktop/File2.txt > C:/Users/User/Desktop/Result.txt
Why it displays
>gi30
BBBBBB
as a defferent?
Edit 1: What I want is to search the occurrence of each line in the file 1 in the whole file 2 because the two files are not ordered and I cannot touch them (genetic data).
Edit 2: I want to execute join command from my php code. it run successfully in cygwin cmd application but, it did not run from my php
shell_exec("C:\\cygwin64\\bin\\bash.exe --login -c 'join -v 1 <(sort $OldDatabaseFile.txt) <(sort $NewDatabaseFile.txt) > $text_files_path/DelSeqGi.txt 2>&1'");
Thanks.