Pages

Tuesday, August 30, 2011

Comapre File Line By Line

 1. Check whether tool "diff" is installed in your system by typing "diff" in terminal.
    If the output is similar to the below one then diff tool is not installed in your system

   diff: missing operand after `diff'
   diff: Try `diff --help' for more information.

2. If the tool diff is not installed, install it using synaptic or terminal(sudo apt-get install diff)

3. Type the following command in the terminal

   diff filename1 filename2

  The above command will print the difference between the two files on the screen.
 You can also direct the output to another file using following command.

  diff filename1 filename2 >> filename3

  You can also ignore case of file contents using follwoing command

  diff -i --ignore-case filename1 filename2 >>filename3

4. For more options of diff
    Type(in terminal) :

    man diff




No comments:

Post a Comment