{"id":97,"date":"2015-06-22T15:49:03","date_gmt":"2015-06-22T19:49:03","guid":{"rendered":"http:\/\/zhouanbo.com\/?p=97"},"modified":"2018-07-12T13:08:57","modified_gmt":"2018-07-12T17:08:57","slug":"intersection-and-subtraction-of-two-files","status":"publish","type":"post","link":"https:\/\/zhouanbo.com\/?p=97","title":{"rendered":"Intersection and subtraction of two data files"},"content":{"rendered":"<p>The efficiency of file processing in Linux environment has a strong positive correlation to how large your brain capacity is to remember common commands. So I write down commands to release brain space.<\/p>\n<p>Intersection of records:<\/p>\n<pre><code class=\"bash\">grep -F -f a.txt b.txt | sort | uniq\n<\/code><\/pre>\n<p>Subtraction of records:<\/p>\n<pre><code class=\"bash\">grep -F -v -f a.txt b.txt | sort | uniq\n# or:\ngrep -F -v -f b.txt a.txt | sort | uniq\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The efficiency of file processing in Linux environment has a strong positive correlation to how large your brain capacity is to remember common commands. So I write down commands to release brain space. Intersection of records: grep -F -f a.txt &#8230; <a class=\"styledbutton\" href=\"https:\/\/zhouanbo.com\/?p=97\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[8],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6eWPT-1z","_links":{"self":[{"href":"https:\/\/zhouanbo.com\/index.php?rest_route=\/wp\/v2\/posts\/97"}],"collection":[{"href":"https:\/\/zhouanbo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhouanbo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhouanbo.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/zhouanbo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97"}],"version-history":[{"count":10,"href":"https:\/\/zhouanbo.com\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":227,"href":"https:\/\/zhouanbo.com\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions\/227"}],"wp:attachment":[{"href":"https:\/\/zhouanbo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhouanbo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhouanbo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}