<?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: find command: replace exec to xargs problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932807#M111946</link>
    <description>more than 100 hundred at least..</description>
    <pubDate>Fri, 21 Mar 2003 12:05:51 GMT</pubDate>
    <dc:creator>Ho_5</dc:creator>
    <dc:date>2003-03-21T12:05:51Z</dc:date>
    <item>
      <title>find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932801#M111940</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I want to replace the exec to xargs in find command, because every time when I run the command CPU is overloaded.&lt;BR /&gt;&lt;BR /&gt;find . -name "*.day.*" -exec cp -r {} /store \; -exec rm -f {} \;</description>
      <pubDate>Fri, 21 Mar 2003 11:30:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932801#M111940</guid>
      <dc:creator>Ho_5</dc:creator>
      <dc:date>2003-03-21T11:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932802#M111941</link>
      <description>I'm not sure how you would chain the two commands together without repeating the find, but using find with xargs is easy:&lt;BR /&gt;&lt;BR /&gt;find . -name "*.day.*" |xargs cp -r;find . -name "*.day.*" |xargs rm -f&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 21 Mar 2003 11:39:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932802#M111941</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-03-21T11:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932803#M111942</link>
      <description>thanks, but it should not work&lt;BR /&gt;&lt;BR /&gt;I try to change it into the next syntax, but the CPU load still HIGH.&lt;BR /&gt;&lt;BR /&gt;find . -name "*.day.*" | xargs -i cp -r "{}" /store | xargs -i rm -f&lt;BR /&gt;&lt;BR /&gt;By the way, do I need to use -i and "{}"???&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;John</description>
      <pubDate>Fri, 21 Mar 2003 11:47:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932803#M111942</guid>
      <dc:creator>Ho_5</dc:creator>
      <dc:date>2003-03-21T11:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932804#M111943</link>
      <description>I'm curious - does running the find command by itself increase your CPU load?&lt;BR /&gt;&lt;BR /&gt;find . -name "*.day.*"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 21 Mar 2003 11:53:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932804#M111943</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-03-21T11:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932805#M111944</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;How many files and directories are in the directory tree at the point where you run the find command?&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Mar 2003 12:02:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932805#M111944</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-03-21T12:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932806#M111945</link>
      <description>The problem is on every half of hour there are two find command's in two different scripts running.&lt;BR /&gt;It looks like running 2 find command in the same time, it will generate CPU overload.&lt;BR /&gt;Reschedule the scripts in the crontab is not possible.&lt;BR /&gt;So any idea how to rebuild the find command??</description>
      <pubDate>Fri, 21 Mar 2003 12:03:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932806#M111945</guid>
      <dc:creator>Ho_5</dc:creator>
      <dc:date>2003-03-21T12:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932807#M111946</link>
      <description>more than 100 hundred at least..</description>
      <pubDate>Fri, 21 Mar 2003 12:05:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932807#M111946</guid>
      <dc:creator>Ho_5</dc:creator>
      <dc:date>2003-03-21T12:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932808#M111947</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;How about trying:&lt;BR /&gt;&lt;BR /&gt;find . -name "*.day.*" | xargs -i echo "cp -r {} /store;rm -f {}" |sh &lt;BR /&gt;&lt;BR /&gt;rgds, Robin.</description>
      <pubDate>Fri, 21 Mar 2003 12:16:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932808#M111947</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2003-03-21T12:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932809#M111948</link>
      <description>Hoi Ho,&lt;BR /&gt;&lt;BR /&gt;Why don't you do the following :&lt;BR /&gt;&lt;BR /&gt;for i in `find ./ -name "*.day.*"`&lt;BR /&gt;do&lt;BR /&gt;cp -r $i /store&lt;BR /&gt;rm -f $i&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Groeten/Regs,&lt;BR /&gt;David</description>
      <pubDate>Fri, 21 Mar 2003 12:21:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932809#M111948</guid>
      <dc:creator>David_246</dc:creator>
      <dc:date>2003-03-21T12:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932810#M111949</link>
      <description>Uhh,&lt;BR /&gt;&lt;BR /&gt;What about :&lt;BR /&gt;&lt;BR /&gt;find ./ -name "*.day.*"  -exec mv {} /store \;&lt;BR /&gt;&lt;BR /&gt;Regs David</description>
      <pubDate>Fri, 21 Mar 2003 12:24:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932810#M111949</guid>
      <dc:creator>David_246</dc:creator>
      <dc:date>2003-03-21T12:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932811#M111950</link>
      <description>hmmmm mv command.&lt;BR /&gt;&lt;BR /&gt;find ./ -name "*.day.*" -exec mv {} /store \; &lt;BR /&gt; &lt;BR /&gt;If I translate it into xargs. should it be like this??&lt;BR /&gt;&lt;BR /&gt;find . -name "*.day.*" | xargs -i mv ./{} /store/{}&lt;BR /&gt;&lt;BR /&gt;The advantage of using "xargs" instead of "exec" is that it save the CPU time or not? if you have a lot of file to find. please confirm this&lt;BR /&gt;&lt;BR /&gt;John</description>
      <pubDate>Fri, 21 Mar 2003 12:38:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932811#M111950</guid>
      <dc:creator>Ho_5</dc:creator>
      <dc:date>2003-03-21T12:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932812#M111951</link>
      <description>Hi Ho:&lt;BR /&gt;&lt;BR /&gt;The advantage to 'xargs' over 'exec' in situations like you describe is really two-fold.  First, you avoid the potential for an "argument list too long".  Secondly, and more importantly, you avoid forking a separate task for every argument processed.&lt;BR /&gt;&lt;BR /&gt;Another often overlooked ability of 'xargs' to bundle, as many arguments as specified by its '-n number' option together into a single execution.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 21 Mar 2003 12:53:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932812#M111951</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-03-21T12:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932813#M111952</link>
      <description>there,&lt;BR /&gt;&lt;BR /&gt;this works.&lt;BR /&gt;&lt;BR /&gt;find ./ -name \*.day.\* -exec /usr/bin/mv {} /store \;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Mar 2003 13:56:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932813#M111952</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-03-21T13:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: find command: replace exec to xargs problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932814#M111953</link>
      <description>find is a pig no matter what you do with it&lt;BR /&gt;&lt;BR /&gt;it has to traverse the I/O super block tables and find what you are looking for&lt;BR /&gt;&lt;BR /&gt;you can nice this process so that it gets whatever cpu is left over&lt;BR /&gt;&lt;BR /&gt;you can cd to the directory you are finding stuff in and then do the find&lt;BR /&gt;&lt;BR /&gt;you have to find (pun intended) ways to reduce the number of I/O trees that the command is searching thru to find what you want</description>
      <pubDate>Fri, 21 Mar 2003 14:33:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command-replace-exec-to-xargs-problem/m-p/2932814#M111953</guid>
      <dc:creator>John Bolene</dc:creator>
      <dc:date>2003-03-21T14:33:10Z</dc:date>
    </item>
  </channel>
</rss>

