3

When I perform diff between old to new files I get that DDDC string exsist in the old file by the sign "<" as the follwoing

diff -w old   new
103a104
> BBB
224c225
< DDDC

But please advice if diff can display only the string DDDC from the old file without the sign as "<" or ">" or some numbers as 103a104 or 224c225 etc and all that silly things

For example (requested output from diff hope it realistic -

diff -w old new
DDDC

I need to get the following format (only the strings that exists in the old file and not appears in the new file)

2 Answers 2

2

Give this a try:

diff --old-line-format=$'%l\n' --new-line-format='' --changed-group-format='%<' --unchanged-group-format='' old new

Also, try this for comparison

join -v 1 <(sort old) <(sort new)
1

Try this:

diff old new|grep "^< "|cut -c 3-

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .