This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
fuss:grep [2016/01/10 18:25] – office | fuss:grep [2022/04/19 08:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Set Intersection / Set Subtraction ====== | ||
+ | |||
+ | To find lines that are in both of two files (intersection) or in only one of the two files (subtraction), | ||
+ | |||
+ | <code bash> | ||
+ | # intersection of file1 and file2 | ||
+ | grep -xF -f file1 file2 | ||
+ | |||
+ | # subtraction of file1 from file2 | ||
+ | grep -vxF -f file1 file2 | ||
+ | </ | ||
+ | |||
+ | ====== Trim Commented and Blank Lines ====== | ||
+ | |||
+ | Many Linux configuration files use the hash sign (''#'' | ||
+ | <code bash> | ||
+ | grep -v -e " | ||
+ | </ | ||
+ | |||
+ | will remove ('' | ||