<?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: A recursive grep from root directory doesnt work as expected in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533643#M651983</link>
    <description>Victor,&lt;BR /&gt;&lt;BR /&gt;Using -exec instead of xargs will create a child process for each output string from the find command to the grep. This is very disadvantageous resources wise.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;</description>
    <pubDate>Fri, 13 Nov 2009 20:13:21 GMT</pubDate>
    <dc:creator>yaron1</dc:creator>
    <dc:date>2009-11-13T20:13:21Z</dc:date>
    <item>
      <title>A recursive grep from root directory doesnt work as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533641#M651981</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I do a recursive grep (piped from a find) on the entire file system (from / downward). I do:&lt;BR /&gt;find / -type f 2&amp;gt;&amp;gt;1err.txt -print |xargs grep mystring 2&amp;gt;&amp;gt;2err.txt&lt;BR /&gt;&lt;BR /&gt;It simply doesnt find the expected string. While I know at least some files (with permission to read) where the string exists (under a certain directory). When I do:&lt;BR /&gt;&lt;BR /&gt;find /certain_directory/ -type f 2&amp;gt;&amp;gt;1err.txt -print |xargs grep mystring 2&amp;gt;&amp;gt;2err.txt&lt;BR /&gt;&lt;BR /&gt;It will find the string in the expected file in a sub directory of certain_directory. &lt;BR /&gt; &lt;BR /&gt;The 2&amp;gt;&amp;gt; is to avoid the messages on files that my user doesnt have permission to read.  &lt;BR /&gt;&lt;BR /&gt;What can be the reason? If its a symbolic link permission problem how can I display or detect it?&lt;BR /&gt;&lt;BR /&gt;It’s a POSIX shell if I’m not wrong.&lt;BR /&gt;&lt;BR /&gt;Thanks for the answers.&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Nov 2009 19:02:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533641#M651981</guid>
      <dc:creator>yaron1</dc:creator>
      <dc:date>2009-11-13T19:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: A recursive grep from root directory doesnt work as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533642#M651982</link>
      <description>Hi &lt;BR /&gt;I'm afraid, the problem is in xargs format.&lt;BR /&gt;Try the following:&lt;BR /&gt;&lt;BR /&gt;find / -type f  -exec grep -l mystring {} \; &lt;BR /&gt;&lt;BR /&gt;This works, tested and confirmed.&lt;BR /&gt;&lt;BR /&gt;HTH</description>
      <pubDate>Fri, 13 Nov 2009 19:24:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533642#M651982</guid>
      <dc:creator>Victor Fridyev</dc:creator>
      <dc:date>2009-11-13T19:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: A recursive grep from root directory doesnt work as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533643#M651983</link>
      <description>Victor,&lt;BR /&gt;&lt;BR /&gt;Using -exec instead of xargs will create a child process for each output string from the find command to the grep. This is very disadvantageous resources wise.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Nov 2009 20:13:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533643#M651983</guid>
      <dc:creator>yaron1</dc:creator>
      <dc:date>2009-11-13T20:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: A recursive grep from root directory doesnt work as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533644#M651984</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Using -exec instead of xargs will create a child process for each output string from the find command to the grep. This is very disadvantageous resources wise.&lt;BR /&gt;&lt;BR /&gt;That's true _if_ you terminate the '-exec' argument with a semicolon.  If you use a '+' as a terminator, multiple arguments are bundled together and passed en mass to the process spawned --- the equivalent of 'xargs'.  Thus:&lt;BR /&gt;&lt;BR /&gt;# find / -type f -exec grep -l mystring {} +&lt;BR /&gt;&lt;BR /&gt;...is very efficient from the standpoint of the spawning of processes.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 13 Nov 2009 20:27:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533644#M651984</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-11-13T20:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: A recursive grep from root directory doesnt work as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533645#M651985</link>
      <description>&amp;gt;It simply doesn't find the expected string.&lt;BR /&gt;&lt;BR /&gt;It should but it may take forever.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;If it's a symbolic link permission problem how can I display or detect it?&lt;BR /&gt;&lt;BR /&gt;Symlink permissions are ignored.&lt;BR /&gt;find(1) won't follow symlinks unless you use -follow.  But if you are starting in /, that shouldn't matter.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Victor: the problem is in xargs format.&lt;BR /&gt;&lt;BR /&gt;What's wrong with it?  yaron1 had it working with a different find(1).</description>
      <pubDate>Sat, 14 Nov 2009 02:19:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533645#M651985</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-11-14T02:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: A recursive grep from root directory doesnt work as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533646#M651986</link>
      <description>Hi yaron1,&lt;BR /&gt;&lt;BR /&gt;I would check the collected output in the files ?err.txt.&lt;BR /&gt;- Does one of the parent directories contain names including spaces? The grep will not get them correctly!&lt;BR /&gt;- Maybe the 'find /' lasts forever or you did specify other find-options (-xdev?) which skip /certain_directory ?&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Mon, 16 Nov 2009 19:00:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533646#M651986</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2009-11-16T19:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: A recursive grep from root directory doesnt work as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533647#M651987</link>
      <description>&lt;!--!*#--&gt;&amp;gt; - Does one of the parent directories&lt;BR /&gt;&amp;gt; contain names including spaces? The grep&lt;BR /&gt;&amp;gt; will not get them correctly!&lt;BR /&gt;&lt;BR /&gt;Which "grep"?  Why?&lt;BR /&gt;&lt;BR /&gt;rux # uname -a&lt;BR /&gt;HP-UX rux B.11.31 U ia64 1678555272 unlimited-user license&lt;BR /&gt;&lt;BR /&gt;rux # ls -l&lt;BR /&gt;total 0&lt;BR /&gt;&lt;BR /&gt;rux # pwd  &lt;BR /&gt;/root/itrc/ro  ot&lt;BR /&gt;&lt;BR /&gt;rux # mkdir 'a  b'&lt;BR /&gt;&lt;BR /&gt;rux # echo fred &amp;gt; 'a  b/c  d'&lt;BR /&gt;&lt;BR /&gt;rux # find . -type f -exec grep fred {} \; -exec ls -l {} \;&lt;BR /&gt;fred&lt;BR /&gt;-rw-r--r--   1 root       sys              5 Nov 16 07:54 ./a  b/c  d&lt;BR /&gt;&lt;BR /&gt;Some things actually _do_ work, even with&lt;BR /&gt;messy file names.  Perhaps "find" is smarter&lt;BR /&gt;than you think.</description>
      <pubDate>Mon, 16 Nov 2009 20:02:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533647#M651987</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-11-16T20:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: A recursive grep from root directory doesnt work as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533648#M651988</link>
      <description>Hi (Steven),&lt;BR /&gt;&lt;BR /&gt;yaron1 used find ... | xargs &lt;BR /&gt;&lt;BR /&gt;Do you try this?&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Mon, 16 Nov 2009 21:10:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533648#M651988</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2009-11-16T21:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: A recursive grep from root directory doesnt work as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533649#M651989</link>
      <description>&lt;!--!*#--&gt;&amp;gt; yaron1 used find ... | xargs &lt;BR /&gt;&lt;BR /&gt;Yes, and someone else didn't, and you didn't&lt;BR /&gt;say what you were talking about (other than&lt;BR /&gt;"The grep [...]").&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Do you try this?&lt;BR /&gt;&lt;BR /&gt;Why would I?  "find -exec" normally does what&lt;BR /&gt;I need to do, without adding the&lt;BR /&gt;complications of xargs.</description>
      <pubDate>Mon, 16 Nov 2009 21:32:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-recursive-grep-from-root-directory-doesnt-work-as-expected/m-p/4533649#M651989</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-11-16T21:32:44Z</dc:date>
    </item>
  </channel>
</rss>

