The Archives

  • 06.Mar.12
    Colored diff shell | fernape | (0)
    As a programmer I am used to dealing with diff files. If you do not know what a diff file is, here you can find a nice description. They are simply text files so they can be viewed with less, more, cat and other common utilities. The main problem is that those utilities do not recognize these files' special syntax. cdiff (/usr/ports/textproc/cdiff) is a small utility that shows diff files in a colored fashion. It can be used this way: $ cdiff file.diff Of course, Vim can be useful here too ;) svn diff | vim -R - Enjoy!
  • 25.Nov.09
    Comparing directories in local or remote hosts shell | rafacas | (0)
    I frequently need to compare two directories (with similar structures) to find different or new files. When I have to compare them locally, I use the diff command. $ ls test* test: file1 file2 file3 file4 file5 file1 file2 file3 file4 file5 file6 $ diff -qr test Files test/file2 and differ Files test/file4 and differ Only in file6 The -q option tells diff to tell only whether the files differ and the -r option is for recursively comparing inside subdirectories. A more complicated problem arises when the comparation has to be done remotely, that is one of the directories is in another host (Samba, NFS, etc ...
  • 28.Nov.08
    Parallel diff cmd | pfortuny | (0)
    $ diff -W80 -y one two this is it | this si it and this is that and this is that [The relevant option is '-y']. Shows all the lines of both files in parallel (line by line) and places a vertical line '|' between them when the corresponding lines differ. The ...