Re: Is it possible to return the line available in FILE1 but not FILE2 in diff?

Charles Swiger <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
Hi--

On Nov 12, 2012, at 3:19 PM, Peng Yu wrote:
> I just want to return the line available in FILE1 but not FILE2 in
> diff. After I read the document, it seems that this is not possible.
> Could anybody confirm whether this is true? If so, is there an
> alternative tool that does this? Thanks!

Using diff will show removed lines with a "-"; otherwise, consider
using the comm utility since that might be closer to what you want...

% cat > FILE1
This 
is   
a 
test
file.
% tail -4 FILE1 >! FILE2                                                                                                                               % diff -bdu FILE1 FILE2
--- FILE1	2012-11-12 16:37:45.000000000 -0800
+++ FILE2	2012-11-12 16:38:11.000000000 -0800
@@ -1,4 +1,3 @@
-This
 is
 a
 test

% comm FILE1 FILE2
This
		is
		a
		test
		file.

Regards,
-- 
-Chuck
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.