Find the answer to your Linux question:
Results 1 to 4 of 4
I am sure that this is a dumb question that I should know, but I can not find the answer on google and the man pages do not say. Of ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! lx4svr's Avatar
    Join Date
    Jun 2007
    Posts
    19

    the diff command help.


    I am sure that this is a dumb question that I should know, but I can not find the answer on google and the man pages do not say. Of course I could just be blind, or searching incorrectly.

    The pipe "|" in the output of the "diff -y file1 file2" command confuses me, and I was hoping that someone could tell me what it means.

    I know that the "<" means in file1, and the ">" means in file2, and no mark is an exact match. What I need to know is what does the "|" pipe mean. It shows two separate items that are not the same, and seams to mean that neither are in the opposite files, but why wouldn't it just have separate lines with the appropriate "<" or ">".

    Or is there a switch that I am missing that can avoid this.

    I rarely use the diff command, and quite often prefer the "comm" command, but I have had this come up a few times when using the "diff" command, and each time I search for that answer and never to find it.

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    The '|' means the line appears in both files and is mostly the same but something on the line is different.

    For example:

    Code:
    cat a.a
    _ver="$4"
    
    cat b.b
    _ver="$5"
    
    diff -y a.a b.b
    _ver="$4" | _ver="$5"
    The difference in this example is a.a has '4' and b.b has '5' in the line.

  3. #3
    Just Joined! lx4svr's Avatar
    Join Date
    Jun 2007
    Posts
    19
    That does make sense, but unfortunately the output that I get is completely different.

    /images/icons/pub.gif <
    /images/icons/txt.gif /images/icons/txt.gif
    /images/icons/xls.gif /images/icons/xls.gif
    /images/new graphics /images/new graphics
    /images/new graphics/banner_top.gif | /images/new graphics/BOARDS.jpg
    /images/new graphics/banner_top.jpg | /images/new graphics/Message Boards Red.jpg
    /images/new graphics/banner_top.psd | /images/new graphics/MESSAGE.jpg
    /images/new graphics/Biglogo.jpg | /images/new graphics/Side Locker.jpg
    /images/new graphics/logogreen.doc | /images/new graphics/Top graphic2.jpg
    /images/new graphics/StMonicaSchoollogo.bmp | /images/new graphics/Top graphic.jpg
    /images/old_graphics /images/old_graphics
    /images/spacer.gif | /images/old_graphics/banner_top_1.jpg
    /images/swlogo.gif | /images/old_graphics/banner_top_2.jpg
    /images/swlogo_trans.gif | /images/old_graphics/banner_top.jpg

  4. #4
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    can you give us the exact command where you encounter this problem so that we can see and tell you.

Posting Permissions

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