Results 1 to 3 of 3

Thread: " diff command in linux problem"

  1. #1

    Question " diff command in linux problem"

    if we use the diff command which finds differences in the two files specified at the command prompt for example take a file named "text"
    which has the contents the following:->

    " this is a test file"

    and other file named "exam" which has the following contents:->

    "this is a exam file"
    then we execute the command at the shell prompt : diff test exam
    then we have the following result on the screen
    1c1
    < this is a test file
    ---
    > this is a exam file


    i want to ask is that what does 1c1 stands for?

    thanks in advance
    vpandiya

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    711
    Clue... count the lines.

    Now try it with a few more lines.


    [edit]
    BTW, why do I get the feeling like you're trying to get us to do your homework for you?
    [/edit]
    \"Windows has detected that a gnat has farted in the general vicinity. You must reboot for changes to take affect. Reboot now?\"

  3. #3
    Senior Member roswell1329's Avatar
    Join Date
    Jan 2002
    Posts
    670
    Hehehe....good call draziw.

    hackmania -- here's a good explanation of the diff command from the WONDERFUL book O'Reilly Power Tools:

    http://linux.oreillynet.com/pub/a/linux/lpt/28_01.html

    But, basically, a diff report is usually in ed syntax, because if you use a diff -e, it will actually produce an ed script that when run would make file1 the same as file2. In your example, 1c1 (I think...I never use ed for anything) means line 1, change for line 1. Basically, change line 1 of the first file to be the same as line 1 of the second file.
    /* You are not expected to understand this. */

Posting Permissions

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