diff & comm


Forum: Other Help Topics
Topic: diff & comm
started by: clivesay

Posted by clivesay on Jan. 15 2005,02:21
bookmark

A while back someone enlightened me to the "diff" command. This allows you to compare the text in two files and output the differences between the two. I used it to build a .dsl with self extracting deb files  by taking a snapshot of the filesystem before the extraction and then a snapshot afterwards to view the differences.

Example:
Code Sample
diff b4.txt aft.txt > change.txt


This has been a handy utility for many different things.

Well, tonight I learned about the opposite command called "comm". This command compares two files and lists the files that are common between the two. This was helpful as I was building a .dsl with gtk2 files and I wanted to purge the files in my new .dsl that already contained files in the gtk2.dsl.

Example:
Code Sample
comm gtk2.txt emel.txt > same.txt


Both of these commands have different options you can see by typing diff --help and comm --help respectively.

I hope these help someone. I learn something new every single day.

Chris

Posted by cbagger01 on Jan. 15 2005,20:36
Hm...

I've been a big fan of diff when I was using the VMS operating system.  Never knew about comm though.  Thanks for the tip.  I'm sure it will come in handy someday.

Posted by petergunn on Jan. 19 2005,20:21
vimdiff makes it much more obviosu what has changed between the two files over the regular diff...

vimdiff <file1> <file2>

give it a whirl :-)

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.