Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

share|improve this question
up vote 2 down vote accepted

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)
share|improve this answer

Try this:

diff old new|grep "^< "|cut -c 3-
share|improve this answer

You must log in to answer this question.

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