They're information on the differences between the files (line numbers in both files, deleted marker, and what the lines were). Check your system documentation for diff ( man diff ).
Ofcourse , CarloM is right. diff command tells us the differences between two files.So if we remove 6,7d5 or any such information from output the remaining information will be useless.Although the above code completes the asked requirement.
sorry friends...I made a mistake...I didnot paid attention on the line "can you please tell me why I'm getting them" of post #3.That is why I have written above not required code.
Now
Here is an explanation of output of diff command:
0a1,2
> line1
> line2
means append line1 and line2 after line 0 of first file
2c4
< linex ---> line 2 of first file
--
> liney ----> line 4 of second file
means change line 2 of first file with line 4 of 2nd file
and
4d5
< linez ---> line 4 of first file
means delete line 4 of first file
so, here a means append, c means change and d means delete
number before a or d or c refers to line number in file1
number before a or d or c refers to line number in file2
Finally, if you follow the modifications suggested by diff, then you are going to make both queried files identical.
So far I'm using following command to get difference of Newfile
grep -vxFf oldfile newfile
oldfile:
weather is pleasant
I am happy
newfile:
weather is pleasant
I am happy
it is raining outside
output
it is raining outsidehttp://linux.unix.com/images/editor/menupop.gif
so far its fine. but if i have new file like:
newfile:
weather WAS pleasant
I am happy
it is raining outside
Then output is
weather WAS pleasant
it is raining outsidehttp://linux.unix.com/images/editor/menupop.gif
Now this is the thing that I dont want... I just want that line that is completely changed (added or removed). if only few words of that line are modified then it shouldn't add that line in output. is there any way to modify this grep command to get my required result? thanks.
I don't think that would be workable. Have a look at your original post in number 1 and tell me if changes to 4 words in a line would not constitute a change? It seems to me this thread has petered out into something else. If you have new requirements then I suggest you open a new thread with a clear description, I am closing this one.