<?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 locating path names within files using grep in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/locating-path-names-within-files-using-grep/m-p/3524270#M220362</link>
    <description>HP-UX 11.0 L2000&lt;BR /&gt;&lt;BR /&gt;The below grep command only produces the following output. When the errors are not being suppressed with -s it states file is inaccessible even though I'm running as root. Do I need to take the server offline and shutdown the database to run this script to completion. After the grep command encounters inaccessible files it just stops and does not continue. Any way to suppress files that are in use or search in use files? If you have a better script let me know. &lt;BR /&gt;&lt;BR /&gt;find . -exec grep -l -s  '/oracle8/product/8.1.7' '{}' \; &amp;gt;doug.txt &lt;BR /&gt;&lt;BR /&gt;./etc/passwd&lt;BR /&gt;./etc/oratab&lt;BR /&gt;./etc/rc.log&lt;BR /&gt;./etc/rc.log.old&lt;BR /&gt;./etc/sam/br/graphJGAa20027&lt;BR /&gt;./etc/passwd.old&lt;BR /&gt;./etc/passwd.old1&lt;BR /&gt;./etc/passwd.032305&lt;BR /&gt;./etc/passwd.n25&lt;BR /&gt;</description>
    <pubDate>Wed, 13 Apr 2005 11:37:27 GMT</pubDate>
    <dc:creator>Doug_85</dc:creator>
    <dc:date>2005-04-13T11:37:27Z</dc:date>
    <item>
      <title>locating path names within files using grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/locating-path-names-within-files-using-grep/m-p/3524270#M220362</link>
      <description>HP-UX 11.0 L2000&lt;BR /&gt;&lt;BR /&gt;The below grep command only produces the following output. When the errors are not being suppressed with -s it states file is inaccessible even though I'm running as root. Do I need to take the server offline and shutdown the database to run this script to completion. After the grep command encounters inaccessible files it just stops and does not continue. Any way to suppress files that are in use or search in use files? If you have a better script let me know. &lt;BR /&gt;&lt;BR /&gt;find . -exec grep -l -s  '/oracle8/product/8.1.7' '{}' \; &amp;gt;doug.txt &lt;BR /&gt;&lt;BR /&gt;./etc/passwd&lt;BR /&gt;./etc/oratab&lt;BR /&gt;./etc/rc.log&lt;BR /&gt;./etc/rc.log.old&lt;BR /&gt;./etc/sam/br/graphJGAa20027&lt;BR /&gt;./etc/passwd.old&lt;BR /&gt;./etc/passwd.old1&lt;BR /&gt;./etc/passwd.032305&lt;BR /&gt;./etc/passwd.n25&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Apr 2005 11:37:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/locating-path-names-within-files-using-grep/m-p/3524270#M220362</guid>
      <dc:creator>Doug_85</dc:creator>
      <dc:date>2005-04-13T11:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: locating path names within files using grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/locating-path-names-within-files-using-grep/m-p/3524271#M220363</link>
      <description>1. Use GNU grep&lt;BR /&gt;# grep -r -l -s '/oracle8/product/8.1.7' . &amp;gt;doug.txt&lt;BR /&gt;&lt;BR /&gt;2. Don't use -exec and don't grep pipes or dirs&lt;BR /&gt;# find . -type f | xargs grep -l -s '/oracle8/product/8.1.7'&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Wed, 13 Apr 2005 11:47:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/locating-path-names-within-files-using-grep/m-p/3524271#M220363</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-04-13T11:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: locating path names within files using grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/locating-path-names-within-files-using-grep/m-p/3524272#M220364</link>
      <description>H.Merijn,&lt;BR /&gt;&lt;BR /&gt;Your number #2 option worked great. Thank you for the quick response.&lt;BR /&gt;&lt;BR /&gt;Doug</description>
      <pubDate>Wed, 13 Apr 2005 11:58:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/locating-path-names-within-files-using-grep/m-p/3524272#M220364</guid>
      <dc:creator>Doug_85</dc:creator>
      <dc:date>2005-04-13T11:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: locating path names within files using grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/locating-path-names-within-files-using-grep/m-p/3524273#M220365</link>
      <description>About the only way files would be inaccessible when running as root would be if these were temporary files that have been deleted since the find started. I suspect that you are grepping extremely large files and that is your hang or grep is dying because you are using it on binary files. You really should refine your search so that it only looks for files (not directories or device nodes) and then tests to see if these files are text files (or at least contain text).&lt;BR /&gt;&lt;BR /&gt;TARGET="/oracle8/product/8.1.7"&lt;BR /&gt;&lt;BR /&gt;find . -type f | while read X&lt;BR /&gt;  do&lt;BR /&gt;     file "${X}" | grep -q -i "text"&lt;BR /&gt;     STAT=${?}&lt;BR /&gt;     if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;       then&lt;BR /&gt;         grep -q "${TARGET}" "${X}"&lt;BR /&gt;         STAT=${?}&lt;BR /&gt;         if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;           then&lt;BR /&gt;             echo "File: ${X}"&lt;BR /&gt;           fi  &lt;BR /&gt;       fi&lt;BR /&gt;  done &lt;BR /&gt;&lt;BR /&gt;The "file" command will restrict you to only text files (scripts are text).&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Apr 2005 11:58:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/locating-path-names-within-files-using-grep/m-p/3524273#M220365</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-04-13T11:58:52Z</dc:date>
    </item>
  </channel>
</rss>

