{"id":5552,"date":"2004-12-01T22:04:18","date_gmt":"2004-12-02T06:04:18","guid":{"rendered":"http:\/\/www.ikillspies.com\/blog\/2004\/12\/01\/5552\/"},"modified":"2004-12-01T22:04:18","modified_gmt":"2004-12-02T06:04:18","slug":"stupid-sysadmin-tricks-uniq","status":"publish","type":"post","link":"http:\/\/www.ikillspies.com\/?p=5552","title":{"rendered":"Stupid SysAdmin Tricks: Uniq"},"content":{"rendered":"<div class=\"quote\">\n<p class=\"quote\">SHAC: i just remembered one of the silliest sysadmin hacks ever<\/p>\n<p class=\"quote\">SHAC: if you have a file that sometimes has duplicate lines<\/p>\n<p class=\"quote\">SHAC: and sometimes doesnt<\/p>\n<p class=\"quote\">SHAC: and you want to process each line once<\/p>\n<p class=\"quote\">SHAC: if file is called foo<\/p>\n<pre>cat foo foo | sort | uniq -d > bar<\/pre>\n<p class=\"quote\">SHAC: so you cat foo twice into sort so EVERY line has at least 2 instances&#8230; then you sort them all out&#8230; then you use uniq and say &#8220;tell me what lines are duplicated&#8221;<\/p>\n<p class=\"quote\">SHAC: of course every line is duplicated, but uniq only tells you that once<\/p>\n<p class=\"quote\">BRAIN: that is brilliant<\/p>\n<p class=\"quote\">SHAC: &#8220;boss&#8221; taught me it like 4 years ago<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>SHAC: i just remembered one of the silliest sysadmin hacks ever SHAC: if you have a file that sometimes has duplicate lines SHAC: and sometimes doesnt SHAC: and you want to process each line once SHAC: if file is called foo cat foo foo | sort | uniq -d > bar SHAC: so you cat [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-5552","post","type-post","status-publish","format-standard","hentry","category-looky"],"_links":{"self":[{"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=\/wp\/v2\/posts\/5552","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5552"}],"version-history":[{"count":0,"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=\/wp\/v2\/posts\/5552\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5552"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}