bash command for make difference between two txt file
hi all
I have two txt file (let test1.txt and test2.txt. These txt file contains names. I want make a 3rd txt file which contain names(those name which are exists only in file test1.txt) and 4th txt file which contain (those name which are exists only in file test2.txt). what is solution of this problem? Thanks & Regards KKPal |
Quote:
and manipulate the output using > and < which indicate wo thich file the lines belong |
Take a look at "cmp" and "diff"
|
Quote:
diff test1.txt test2.txt > text.txt but it wasn't work. I need only difference not details Thanks & Regards KKPal |
Quote:
diff test2 test1|grep "<"|cut -d' ' -f2 > test4 |
elthox gave you the answer....
Quote:
diff file1 file2 | grep ">" Then use SED to remove the leading ">" EDIT: Elthox beat me to the punch, AND with a better answer... |
Quote:
diff test1 test2|awk '$1=="<"&&$2!=""{print $2}' > test3 (the lines in test 1 and not in test2) |
Quote:
"Persistent Ignorance".....I LIKE it...I think I can use this.....;) |
All times are GMT -5. The time now is 02:10 AM. |