<?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: grep but skip executables in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789154#M943307</link>
    <description>Cody,&lt;BR /&gt;&lt;BR /&gt;Go to the target directory and run:&lt;BR /&gt;&lt;BR /&gt;# grep -li &lt;STRING&gt; *&lt;BR /&gt;&lt;BR /&gt;which will return the list of files having the &lt;STRING&gt;, ignoring the case-sensitivity.&lt;BR /&gt;&lt;BR /&gt;Hai&lt;/STRING&gt;&lt;/STRING&gt;</description>
    <pubDate>Mon, 19 Aug 2002 19:06:01 GMT</pubDate>
    <dc:creator>Hai Nguyen_1</dc:creator>
    <dc:date>2002-08-19T19:06:01Z</dc:date>
    <item>
      <title>grep but skip executables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789153#M943306</link>
      <description>Hi everyone,&lt;BR /&gt;How can I grep a set of files in a directory but ignoring the executables, object, and archives?  Also, is there a way to grep a .gz file without having to gunzip it?&lt;BR /&gt;Thanks,&lt;BR /&gt;-Cody</description>
      <pubDate>Mon, 19 Aug 2002 19:00:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789153#M943306</guid>
      <dc:creator>Cody Godines_1</dc:creator>
      <dc:date>2002-08-19T19:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: grep but skip executables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789154#M943307</link>
      <description>Cody,&lt;BR /&gt;&lt;BR /&gt;Go to the target directory and run:&lt;BR /&gt;&lt;BR /&gt;# grep -li &lt;STRING&gt; *&lt;BR /&gt;&lt;BR /&gt;which will return the list of files having the &lt;STRING&gt;, ignoring the case-sensitivity.&lt;BR /&gt;&lt;BR /&gt;Hai&lt;/STRING&gt;&lt;/STRING&gt;</description>
      <pubDate>Mon, 19 Aug 2002 19:06:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789154#M943307</guid>
      <dc:creator>Hai Nguyen_1</dc:creator>
      <dc:date>2002-08-19T19:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: grep but skip executables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789155#M943308</link>
      <description>If you are doing something like a 'grep something *' then there is no easy way to skip files.&lt;BR /&gt;&lt;BR /&gt;To look at the contents of a gz file do a 'gzcat filename.gz | grep whateveryouarelookingfor'</description>
      <pubDate>Mon, 19 Aug 2002 19:06:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789155#M943308</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2002-08-19T19:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: grep but skip executables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789156#M943309</link>
      <description>Hi Cody:&lt;BR /&gt;&lt;BR /&gt;You could use the 'file' command on the file to descern whether or not the file is an ASCII text file.  If yes, then 'grep' it. &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 19 Aug 2002 19:10:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789156#M943309</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-08-19T19:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: grep but skip executables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789157#M943310</link>
      <description>If it were me I would send each file to the file command and grep for "text". You will also exclude binary data files that way but you will include things that are commands text like Perl scripts.&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Aug 2002 19:23:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789157#M943310</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-08-19T19:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: grep but skip executables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789158#M943311</link>
      <description>Hi Cody,&lt;BR /&gt;&lt;BR /&gt;so the example I gave to your other thread would have to be expanded with lines for ZIPped files:&lt;BR /&gt;&lt;BR /&gt;find /parent -type f -print |&lt;BR /&gt;while read name; do&lt;BR /&gt;case "$name" in&lt;BR /&gt;*.gz) zcat "$name" | grep 'string' &amp;amp;&amp;amp; echo "$name" ;;&lt;BR /&gt;*.Z) pcat "$name" | grep 'string' &amp;amp;&amp;amp; echo "$name" ;;&lt;BR /&gt;*) case "$(file $name)" in&lt;BR /&gt;*text*) grep 'string' $name /dev/null ;;&lt;BR /&gt;esac ;;&lt;BR /&gt;esac&lt;BR /&gt;done | more &lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Wodisch&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Aug 2002 19:32:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789158#M943311</guid>
      <dc:creator>Wodisch_1</dc:creator>
      <dc:date>2002-08-19T19:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: grep but skip executables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789159#M943312</link>
      <description>How about something like this?&lt;BR /&gt;&lt;BR /&gt;for i in *&lt;BR /&gt;do&lt;BR /&gt;if [ "`file $i | grep exe`" = "" ]&lt;BR /&gt;then&lt;BR /&gt;echo "not an exe"&lt;BR /&gt;else&lt;BR /&gt;echo $i "is an exe"&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;This will catch only binary executables. &lt;BR /&gt;&lt;BR /&gt;You could use something like: &lt;BR /&gt;&lt;BR /&gt;for i in `find . -type f`&lt;BR /&gt;blah... &lt;BR /&gt;&lt;BR /&gt;to only search 'real' files and skip links. &lt;BR /&gt;</description>
      <pubDate>Wed, 21 Aug 2002 10:43:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789159#M943312</guid>
      <dc:creator>Rick Beldin</dc:creator>
      <dc:date>2002-08-21T10:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: grep but skip executables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789160#M943313</link>
      <description>How about something like this:&lt;BR /&gt;&lt;BR /&gt;find /etc -type f | xargs -l grep string</description>
      <pubDate>Wed, 21 Aug 2002 12:21:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789160#M943313</guid>
      <dc:creator>John Dvorchak</dc:creator>
      <dc:date>2002-08-21T12:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: grep but skip executables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789161#M943314</link>
      <description>For the text files I would use:&lt;BR /&gt;&lt;BR /&gt;file * | grep text | cut -f1 -d: | xargs grep [-h|-l] &lt;STR&gt; /dev/null&lt;BR /&gt;&lt;BR /&gt;For the .gz file I would use:&lt;BR /&gt;&lt;BR /&gt;gunzip &lt;FILE.GZ&gt;&lt;/FILE.GZ&gt;&lt;/STR&gt;</description>
      <pubDate>Wed, 21 Aug 2002 14:13:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-but-skip-executables/m-p/2789161#M943314</guid>
      <dc:creator>Andrew F Greenwood</dc:creator>
      <dc:date>2002-08-21T14:13:59Z</dc:date>
    </item>
  </channel>
</rss>

