Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
    
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
add comment

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

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

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.