<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Excluding a directory from a recursive search in ksh in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459247#M679968</link>
    <description>Another approach, probably not one for the purists but one I find syntactically easier is to use xargs and grep.&lt;BR /&gt;&lt;BR /&gt;find . | grep -v svn | xargs grep &lt;PATTERN&gt;&lt;BR /&gt;&lt;BR /&gt;I like it because you can iteratively tune the list of files with multiple "| grep -v pattern" until you get what you want and then pipe to xargs and grep for the pattern within the files you are looking for.&lt;BR /&gt;&lt;BR /&gt;(I have never liked the -exec find syntax ;-)&lt;/PATTERN&gt;</description>
    <pubDate>Tue, 14 Jul 2009 23:05:58 GMT</pubDate>
    <dc:creator>Daavid Turnbull_1</dc:creator>
    <dc:date>2009-07-14T23:05:58Z</dc:date>
    <item>
      <title>Excluding a directory from a recursive search in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459238#M679959</link>
      <description>Hello all,&lt;BR /&gt;I would like to avoid seaching through the .svn directory whenever I grep for a pattern.&lt;BR /&gt;For ksh, I generally use &lt;BR /&gt;find . -name "*" -exec grep &lt;PATTERN&gt; {} \; -print&lt;BR /&gt;&lt;BR /&gt;How do I "exclude" a particular directory from a recursive search ?&lt;BR /&gt;&lt;BR /&gt;Thanks..&lt;BR /&gt;&lt;/PATTERN&gt;</description>
      <pubDate>Tue, 14 Jul 2009 10:01:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459238#M679959</guid>
      <dc:creator>vinay naik</dc:creator>
      <dc:date>2009-07-14T10:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding a directory from a recursive search in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459239#M679960</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;One way:&lt;BR /&gt;&lt;BR /&gt;# find . ! -path "./.svn/*" -type f -exec grep &lt;PATTERN&gt; {} +&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;/PATTERN&gt;</description>
      <pubDate>Tue, 14 Jul 2009 10:32:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459239#M679960</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-14T10:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding a directory from a recursive search in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459240#M679961</link>
      <description>Thanks James.&lt;BR /&gt;But I have multiple .svn in recursive directories. The solution excludes .svn only in the current directory.</description>
      <pubDate>Tue, 14 Jul 2009 11:04:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459240#M679961</guid>
      <dc:creator>vinay naik</dc:creator>
      <dc:date>2009-07-14T11:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding a directory from a recursive search in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459241#M679962</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; But I have multiple .svn in recursive directories. The solution excludes .svn only in the current directory.&lt;BR /&gt;&lt;BR /&gt;You didn't make that clear at the oneset, so try this:&lt;BR /&gt;&lt;BR /&gt;# find . ! -path "*/.svn/*" -type f -exec grep &lt;PATTERN&gt; {} +&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/PATTERN&gt;</description>
      <pubDate>Tue, 14 Jul 2009 11:19:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459241#M679962</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-14T11:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding a directory from a recursive search in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459242#M679963</link>
      <description>That worked fine. Thanks for your help.</description>
      <pubDate>Tue, 14 Jul 2009 11:24:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459242#M679963</guid>
      <dc:creator>vinay naik</dc:creator>
      <dc:date>2009-07-14T11:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding a directory from a recursive search in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459243#M679964</link>
      <description>Hi,&lt;BR /&gt;One more question..&lt;BR /&gt;How can I 'avoid' searching a pattern in binary files such as executables and libraries? Are there options to the 'find' or 'grep' commands to isolate search only in ASCII files?&lt;BR /&gt;&lt;BR /&gt;-Thanks</description>
      <pubDate>Tue, 14 Jul 2009 11:52:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459243#M679964</guid>
      <dc:creator>vinay naik</dc:creator>
      <dc:date>2009-07-14T11:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding a directory from a recursive search in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459244#M679965</link>
      <description>find or grep dors not have switches to differentiate between ascii and binary files. you need to build a logic like :&lt;BR /&gt;&lt;BR /&gt;for f `ls /tmp`&lt;BR /&gt;do&lt;BR /&gt;file ${$f} | grep -q text&lt;BR /&gt;r=${?}&lt;BR /&gt;if [ ${r} -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;#this is a text file either command script or ascii text&lt;BR /&gt;grep &lt;PATTERN&gt; ${f&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;/PATTERN&gt;</description>
      <pubDate>Tue, 14 Jul 2009 12:00:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459244#M679965</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-07-14T12:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding a directory from a recursive search in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459245#M679966</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; How can I 'avoid' searching a pattern in binary files such as executables and libraries?&lt;BR /&gt;&lt;BR /&gt;We could leverage Perl, like:&lt;BR /&gt;&lt;BR /&gt;# perl -MFile::Find -e 'find(sub{push @f,$File::Find::name if $File::Find::dir !~m{\.svn/} &amp;amp;&amp;amp; -f $_ &amp;amp;&amp;amp; -T _},".") ;@a=`grep -i $ARGV[0] @f`;print for sort @a' PATTERN&lt;BR /&gt;&lt;BR /&gt;Specify your PATTERN to be matched as the argument to the script.  Note that the '.svn' directory has its dot character escaped (backslashed) to signify that the dot is not a metacharcter in the regular expression match.&lt;BR /&gt;&lt;BR /&gt;This script looks for files in the current directory but skips any that are not "text" ('-T') ones.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 14 Jul 2009 12:29:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459245#M679966</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-14T12:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding a directory from a recursive search in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459246#M679967</link>
      <description>&amp;gt;I would like to avoid searching through the .svn directory whenever I grep for a pattern.&lt;BR /&gt;&lt;BR /&gt;If you want to exclude all .svn directories and subdirectories, then the right option is -prune.  Especially if you don't want find to search those subdirectories.&lt;BR /&gt;&lt;BR /&gt;To use -prune:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1276654" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1276654&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1309998" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1309998&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1323863" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1323863&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1271016" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1271016&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1303248" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1303248&lt;/A&gt;</description>
      <pubDate>Tue, 14 Jul 2009 15:30:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459246#M679967</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-07-14T15:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding a directory from a recursive search in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459247#M679968</link>
      <description>Another approach, probably not one for the purists but one I find syntactically easier is to use xargs and grep.&lt;BR /&gt;&lt;BR /&gt;find . | grep -v svn | xargs grep &lt;PATTERN&gt;&lt;BR /&gt;&lt;BR /&gt;I like it because you can iteratively tune the list of files with multiple "| grep -v pattern" until you get what you want and then pipe to xargs and grep for the pattern within the files you are looking for.&lt;BR /&gt;&lt;BR /&gt;(I have never liked the -exec find syntax ;-)&lt;/PATTERN&gt;</description>
      <pubDate>Tue, 14 Jul 2009 23:05:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/excluding-a-directory-from-a-recursive-search-in-ksh/m-p/4459247#M679968</guid>
      <dc:creator>Daavid Turnbull_1</dc:creator>
      <dc:date>2009-07-14T23:05:58Z</dc:date>
    </item>
  </channel>
</rss>

