The code you presented in the OP worked fine for me. I assume the problem you had understanding the output was due to the differences in whitespace at the ends of the lines in your sample text files. The whitespace made some of the lines appear to be different. Once I removed the extra whitespace here is the output which makes sense to me:
--- a_file.txt Fri Feb 1 13:30:39 2013
+++ b_file.txt Fri Feb 1 13:30:55 2013
@@ -1,6 +1,4 @@
-a_file.txt sample:
+b_file.txt sample:
http://www.ok.com/test_www.pdf
-http://www.ok.com/test_1234.html
http://www.ok.com/test_part.pdf
http://www.ok.com/test_345.pdf
-http://www.ok.com/test_error.html