Personalize Diff Command in Ubuntu
Posted
by
acidboy
on Stack Overflow
See other posts from Stack Overflow
or by acidboy
Published on 2013-10-31T15:20:43Z
Indexed on
2013/10/31
21:55 UTC
Read the original article
Hit count: 108
I have two files, both with a lot of data, what I need is compare the first word of each file (each file always starts with a number, and each number could have many digits).
The files are identical when these numbers are the same.
Example: I have 3 files: a.txt, b.txt and c.txt
a.txt content is "1 a b c 3 5 6 hjkj"
b.txt content is "1 c f a 1234 h"
c.txt content is "2 a b c 3 5 6 hjkj"
diff a.txt b.txt should return "files are identical"
diff a.txt c.txt should return "files are different"
How can I compare them using the diff command?
© Stack Overflow or respective owner