{"id":16,"date":"2009-04-28T08:11:07","date_gmt":"2009-04-28T13:11:07","guid":{"rendered":"http:\/\/blogs.law.harvard.edu\/djcp\/?p=16"},"modified":"2009-04-28T08:17:51","modified_gmt":"2009-04-28T13:17:51","slug":"how-to-extract-uniq-ips-from-apache-via-grep-cut-and-uniq","status":"publish","type":"post","link":"https:\/\/archive.blogs.harvard.edu\/djcp\/2009\/04\/how-to-extract-uniq-ips-from-apache-via-grep-cut-and-uniq\/","title":{"rendered":"How to extract uniq IPs from apache via grep, cut, and uniq"},"content":{"rendered":"<p>Say you&#8217;d like to find out the IP addresses of lines in your apache access.log (or any log file with a similar format, really) that contain &#8220;Googlebot&#8221;: <\/p>\n<pre>grep 'Googlebot' access.log | cut -d' ' -f1 | sort | uniq<\/pre>\n<p>which finds the lines via grep, uses <strong>cut<\/strong> to extract the first field (space delimited), sorts the IP addresses and then <strong>uniq<\/strong>ifies them.<\/p>\n<p>Dirt simple, stupidly powerful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Say you&#8217;d like to find out the IP addresses of lines in your apache access.log (or any log file with a similar format, really) that contain &#8220;Googlebot&#8221;: grep &#8216;Googlebot&#8217; access.log | cut -d&#8217; &#8216; -f1 | sort | uniq which &hellip; <a href=\"https:\/\/archive.blogs.harvard.edu\/djcp\/2009\/04\/how-to-extract-uniq-ips-from-apache-via-grep-cut-and-uniq\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1984,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3484,1100,5728],"class_list":["post-16","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-bash","tag-linux","tag-shellscripting"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/archive.blogs.harvard.edu\/djcp\/wp-json\/wp\/v2\/posts\/16","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/archive.blogs.harvard.edu\/djcp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/archive.blogs.harvard.edu\/djcp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/djcp\/wp-json\/wp\/v2\/users\/1984"}],"replies":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/djcp\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":8,"href":"https:\/\/archive.blogs.harvard.edu\/djcp\/wp-json\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":17,"href":"https:\/\/archive.blogs.harvard.edu\/djcp\/wp-json\/wp\/v2\/posts\/16\/revisions\/17"}],"wp:attachment":[{"href":"https:\/\/archive.blogs.harvard.edu\/djcp\/wp-json\/wp\/v2\/media?parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/djcp\/wp-json\/wp\/v2\/categories?post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/djcp\/wp-json\/wp\/v2\/tags?post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}