Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
fuss:grep [2015/01/09 05:34]
127.0.0.1 external edit
fuss:grep [2017/02/22 18:30] (current)
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),​ use the following commands:
 +
 +<code bash>
 +# intersection of file1 and file2
 +grep -xF -f file1 file2
 +
 +# subtraction of file1 from file2
 +grep -vxF -f file1 file2
 +</​code>​
 +
 +====== Trim Commented and Blank Lines ======
 +
 +Many Linux configuration files use the hash sign (''#''​) as a comment indicator. The following command:
 +<code bash>
 +grep -v -e "​^#"​ -e "​^$"​ /​etc/​squid3/​squid.conf
 +</​code>​
 +
 +will remove (''​-v''​) all the lines starting with comments (''​^#''​) and then additionally will remove blank lines left after the trim (''​^$''​) from the file ''/​etc/​squid3/​squid.conf''​.
  

fuss/grep.txt ยท Last modified: 2017/02/22 18:30 (external edit)

Access website using Tor Access website using i2p


For the copyright, license, warranty and privacy terms for the usage of this website please see the license, privacy and plagiarism pages.