{"id":340,"date":"2010-07-07T23:23:37","date_gmt":"2010-07-08T05:23:37","guid":{"rendered":"http:\/\/blog.supportpro.com\/?p=340"},"modified":"2018-12-13T05:34:30","modified_gmt":"2018-12-13T11:34:30","slug":"ack-betterthan-grep-2","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/ack-betterthan-grep-2\/","title":{"rendered":"ack &#8211; betterthan grep"},"content":{"rendered":"<p>ACK is a tool like grep, designed for programmers with large trees of heterogeneous source code. ACK is written purely in Perl, and takes advantage of the power of Perl&#8217;s regular expressions.<br \/>\n<u>How to install ACK<\/u><br \/>\nIt can be installed any number of ways:<br \/>\n* Install the CPAN module App::Ack. If you are a Perl user already, this is the way to go.<br \/>\n* Download the standalone version of ack that requires no modules beyond what&#8217;s in core Perl, and putting it in your path. If you don&#8217;t want to mess with setting up Perl&#8217;s CPAN shell, this is easiest.<br \/>\ncurl <a href=\"http:\/\/betterthangrep.com\/ack-standalone\">http:\/\/betterthangrep.com\/ack-standalone<\/a> &gt; ~\/bin\/ack &amp;&amp; chmod 0755 !#:3<br \/>\n* Install the Macport<br \/>\n* Install the Ubuntu package: ack-grep<br \/>\n* Install the Fedora package: ack<br \/>\n* Install the Gentoo package: sys-apps\/ack<\/p>\n<p><!--more--><\/p>\n<p>Top 10 reasons to use ack instead of grep.<br \/>\n1. It&#8217;s blazingly fast because it only searches the stuff you want searched.<br \/>\n2. ack is pure Perl, so it runs on Windows just fine.<br \/>\n3. The standalone version uses no non-standard modules, so you can put it in your ~\/bin without fear.<br \/>\n4. Searches recursively through directories by default, while ignoring .svn, CVS and other VCS directories.<\/p>\n<p>* Which would you rather type?<\/p>\n<p>$ grep pattern $(find . -type f | grep -v &#8216;\\.svn&#8217;)<br \/>\n$ ack pattern<br \/>\n5. ack ignores most of the crap you don&#8217;t want to search<\/p>\n<p>* VCS directories<br \/>\n* blib, the Perl build directory<br \/>\n* backup files like foo~ and #foo#<br \/>\n* binary files, core dumps, etc<br \/>\n6. Ignoring .svn directories means that ack is faster than grep for searching through trees.<br \/>\n7. Lets you specify file types to search, as in &#8211;perl or &#8211;nohtml.<br \/>\n* Which would you rather type?<\/p>\n<p>$ grep pattern $(find . -name &#8216;*.pl&#8217; -or -name &#8216;*.pm&#8217; -or -name &#8216;*.pod&#8217; | grep -v .svn)<br \/>\n$ ack &#8211;perl pattern<br \/>\nNote that ack&#8217;s &#8211;perl also checks the shebang lines of files without suffixes, which the find command will not.<br \/>\n8. File-filtering capabilities usable without searching with ack -f. This lets you create lists of files of a given type.<br \/>\n$ ack -f &#8211;perl &gt; all-perl-files<br \/>\n9. Color highlighting of search results.<br \/>\n10.Uses real Perl regular expressions, not a GNU subset.<\/p>\n<p>If you require help, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">contact SupportPRO Server Admin<\/a><\/p>\n<p style=\"text-align: center;\"><!--HubSpot Call-to-Action Code --><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><!-- [if lte IE 8]><\/p>\n\n\n\n\n\n<div id=\"hs-cta-ie-element\"><\/div>\n\n\n<![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b\"><img decoding=\"async\" id=\"hs-cta-img-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-img\" style=\"border-width: 0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b.png\" alt=\"Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value\" \/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '9d590242-d641-4383-94b4-8cfd62f0af6b', {}); <\/script><\/span><!-- end HubSpot Call-to-Action Code --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ACK is a tool like grep, designed for programmers with large trees of heterogeneous source code. ACK is written purely in Perl, and takes advantage of the power of Perl&#8217;s&hellip;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-340","post","type-post","status-publish","format-standard","hentry","category-miscellaneous"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=340"}],"version-history":[{"count":2,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/340\/revisions"}],"predecessor-version":[{"id":3602,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/340\/revisions\/3602"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}