Results 1 to 4 of 4

Thread: Help with diff

  1. #1
    Join Date
    May 2008
    Location
    /root
    Beans
    Hidden!

    Help with diff

    Hi all,
    I try with diff to compare 2 text files, but I want only to
    get the exact output.
    I mean like
    file 1:

    Hello
    World
    How
    Are
    You

    file 2:
    Hello
    How
    Are
    You

    diff file1 file2 to have the output "World"

    Thanks for any help

  2. #2
    Join Date
    Sep 2006
    Beans
    2,914

    Re: Help with diff

    check the diff man page whether there are options for output formatting, otherwise, just simply
    Code:
    diff file1 file2 | awk '/^</{$1="";print}'

  3. #3
    Join Date
    May 2008
    Location
    /root
    Beans
    Hidden!

    Re: Help with diff

    The first thing I did was to have a look at the man page but this option
    doesnt exists or I havent seen it.
    diff file1 file2 | awk '/^</{$1="";print}'
    removes all new lines and dont work (More than half of the differences dont show up)

  4. #4
    Join Date
    Sep 2006
    Beans
    2,914

    Re: Help with diff

    show a sample of what the diff output is, and then how you want it to look like.

Bookmarks

Posting Permissions

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