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!
> 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!
Perhaps you want comm instead of diff:
comm -23 FILE
-- Chris F.A. Johnson <http://cfajohnson.com>
Author: =======================
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
>> 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!
> Perhaps you want comm instead of diff:
> comm -23 FILE
I meant:
comm -23 FILE1 FILE2
-- Chris F.A. Johnson <http://cfajohnson.com>
Author: =======================
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
> 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
> using the comm utility since that might be closer to what you want...
That only works if the files are both sorted.
-- Using RELAX NG compact syntax to John Cowan <co...@ccil.org>
develop schemas is one of the simple http://www.ccil.org/~cowan pleasures in life....
--Jeni Tennison <co...@ccil.org>
Charles Swiger wrote:
> 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...
You might consider that -u may take an optional number of context
lines to display.
`-U LINES'
`--unified[=LINES]'
Use the unified output format, showing LINES (an integer) lines of
context, or three if LINES is not given. *Note Unified Format::.
For proper operation, `patch' typically needs at least two lines of
context.