-
Book Overview & Buying
-
Table Of Contents
Linux Shell Scripting Cookbook, Second Edition - Second Edition
Intersection and set difference operations are commonly used in mathematical classes on set theory. However, similar operations on strings are also very helpful in some scenarios.
The comm command is a utility to perform a comparison between the two files. It has many good options to arrange the output in such a way that we can perform intersection, difference, and set difference operations.
Intersection: The intersection operation will print the lines that the specified files have in common with one another
Difference: The difference operation will print the lines that the specified files contain and that are not the same in all of those files
Set difference: The set difference operation will print the lines in file "A" that do not match those in all of the set of files specified ("B" plus "C" for example)
Note that comm takes only sorted files as input. Take a look at the following example:
$ cat A.txt apple...
Change the font size
Change margin width
Change background colour