How to make one-way diff in Linux?
Normal diff behavior:
Usually diff will tell you all the differences between the two files. For example, he will tell you everything that is in file A, which is not in file B, and also tells you everything that is in file B, but not in file A. For example:
File A contains:
cat
good dog
one
two
File B contains:
cat
some garbage
one
a whole bunch of garbage
something I don't want to know
If I do a regular diff as follows:
diff AB
the output would be something like this:
2c2
< good dog
---
> some garbage
4c4,5
< two
---
> a whole bunch of garbage
> something I don't want to know
What I'm looking for:
What I want is only the first part, for example, I want to know everything that is in file A, but not file B. However, I want it to ignore everything that is in file B, but not in file A.
I want a team or series of commands:
???? Ab
which outputs the result:
2c2
< good dog
4c4,5
< two
, diff sed awk, , . , --- > .
: .
. "": , , RedHat Linux
. , , (, ):
diff