Find the answer to your Linux question:
Results 1 to 3 of 3
Hi Friends, Is there a way to use the diff command between an older and a newer version of a file and only display the lines that have been added ...
  1. #1
    Just Joined!
    Join Date
    Nov 2010
    Posts
    2

    Question Diff Command is possible for me?

    Hi Friends,

    Is there a way to use the diff command between an older and a newer version of a file and only display the lines that have been added to the newer file and not the ones that have been removed without any of the explanation formatting, just the new lines. I'm trying to bypass the process of putting both files into a database and running an SQL "left join where old data is null" as I will need to do this on a regular basis.

    Please let me know if my inquiry is not clear or needs further explanation.

    Thank you in advance for any help you can provide.

    thankfully,
    Anes P.A

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    You can pipe the output thru a sed/awk filter and remove any output that is not inserted data. Sorry that I don't have time to help you with that right now, but perhaps someone else on the forums can do that with some suggestions how. The diff command does allow you to determine what to output based upon regular expressions, but it won't differentiate between inserted, deleted, or changed data.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Nov 2010
    Posts
    2

    Red face Hi Thanks

    Hi Rubber man Friend,

    I got a Solution through this : "Anyway, I would use 'comm' for this, see 'man comm', you'll probably use 'comm -13' or '-23'

    Thanks For ur Help

    Bye Anes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...