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

I have file1 that contains lines exactly the same as file2 BUT file 2 has more lines. I need to extract these additional line ONLY. I tried diff command but the output really long and I need just the additional lines. Can anybody help ?

share|improve this question

migrated from stackoverflow.com Aug 21 '12 at 21:03

This question came from our site for professional and enthusiast programmers.

    
I believe different will do what you want but I don't know the exact options. They should be able to help over at superuser – John Watts Aug 20 '12 at 21:24
2  
serverfault.com/a/68786/88978 – Doug Ramsey Aug 20 '12 at 21:25
    
You can also use graphical tools like meld. – Mechanical snail Aug 21 '12 at 21:10
up vote 5 down vote accepted

Try diff -w it will ignore the all whitespaces. Further, you can pipe your output to more this way you'll be able to view all the differences:

 diff -w file1 file2 | more

If you want a nicer display you can use the switch -y which will display two pages side-by side, and -l will add pagination:

diff -wyl file1 file2
share|improve this answer

You must log in to answer this question.

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