I have some text files. I need a separate shell say 1.sh in which i can open a particular text file and compare with another txt file. For example:
1.log.txt contains
apple
ball
cat
goat
2.log.txt contains
goat
cat
lion
apple
fox
In my i.sh i need to write script to compare this two files and write the the o/p.The output should be written onto two different files such that one file contains the words that match and another contains the words that do not match.That is after i run 1.sh i should get common.txt and
notcommon.txt
common.txt should contains words present in both(common to both 1.og.txt & 2.log.txt ).i.e;
apple
ca
goat
nocommon.txt should contain the words present only in 2.log.txt and not in 1.log.txt . i.e;
lion
fox
That is a better code than waht i tried ..
i didnot sort my source files but it was almost in a sorted way .. But its always a good method to sort the files before compiling it ..
Thanks a lot for the quote ..
Regards
JS
thanks for pointing it out .. Actually teh fils where sorted. Hence I ddint go for sorting .. The example i gave was for the name sake ..its not teh actual format of my file ..
thanks a lot for pointing it out .. because i didnt know about it .. its going to help me in the future ..