<?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 scripting help in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5505759#M53502</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following shell in a RHEL 4 Server:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;export DIR=/u01&lt;BR /&gt;for dir in `find $DIR -type d`;&lt;BR /&gt;do&lt;BR /&gt;grep&amp;nbsp;pattern $dir/*;&lt;BR /&gt;done&lt;/P&gt;&lt;P&gt;As the above script gives thousands of files I'm looking for help to actually find the pattern and also change it for another string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be appreciated&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jan 2012 17:30:25 GMT</pubDate>
    <dc:creator>Andres_13</dc:creator>
    <dc:date>2012-01-23T17:30:25Z</dc:date>
    <item>
      <title>scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5505759#M53502</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following shell in a RHEL 4 Server:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;export DIR=/u01&lt;BR /&gt;for dir in `find $DIR -type d`;&lt;BR /&gt;do&lt;BR /&gt;grep&amp;nbsp;pattern $dir/*;&lt;BR /&gt;done&lt;/P&gt;&lt;P&gt;As the above script gives thousands of files I'm looking for help to actually find the pattern and also change it for another string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be appreciated&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2012 17:30:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5505759#M53502</guid>
      <dc:creator>Andres_13</dc:creator>
      <dc:date>2012-01-23T17:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5505903#M53503</link>
      <description />
      <pubDate>Mon, 23 Jan 2012 20:00:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5505903#M53503</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2012-01-23T20:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help with find</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5505947#M53504</link>
      <description>&lt;P&gt;&amp;gt;As the above script gives thousands of files&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1000s of files as in you want to automate it?&amp;nbsp; Or you just want to limit it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have a shell pattern match instead of a grep RE, you can use -name:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DIR=/u01&lt;BR /&gt;find $DIR -type f -name "pattern" | while read file; do&lt;BR /&gt;&amp;nbsp;&amp;nbsp; # do something with filename ...&lt;BR /&gt;done&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2012 21:05:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5505947#M53504</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-01-23T21:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help with find</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5505971#M53505</link>
      <description>&lt;P&gt;I want to automate it. Let me explain a bit more the current state:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have just virtualized a production environment (RHEL 4 running oracle application server). &lt;SPAN&gt;&lt;SPAN class="hps"&gt;It's&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="hps"&gt;a production environment&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;for the purpose&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;of making a&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;development environment.&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;It's something&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;I never did&lt;/SPAN&gt; before and also I do&lt;SPAN class="hps"&gt;n't know&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;how&amp;nbsp;OAS works.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="hps"&gt;S&lt;/SPAN&gt;&lt;SPAN class="hps"&gt;o&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;I thought&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;it&amp;nbsp;it would be easier&amp;nbsp;to&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;change the&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;virtual&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;server&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;hostname&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;and replace the&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;original&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;server name&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;for the&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;virtual&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;of&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;all files&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;containing&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the name&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;of the production system.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="hps"&gt;Answering your question I want to automate the process of find all the files containing the prod server hostname, edit each one of them in order to get all of these files "pointing" to the new virtual server's hostname.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2012 21:24:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5505971#M53505</guid>
      <dc:creator>Andres_13</dc:creator>
      <dc:date>2012-01-23T21:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help with find</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5505983#M53506</link>
      <description>&lt;P&gt;Maybe something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for dir in `find $OAS -type d`;&lt;BR /&gt;do&lt;BR /&gt;FILE=`grep&amp;nbsp;$SOURCE_HOSTNAME $dir/*`;&lt;BR /&gt;if [ $FILE ]; then&lt;BR /&gt;/bin/cat - &amp;lt;&amp;lt; EOF | /bin/ed -s $FILE&lt;BR /&gt;1,$ s/$SOURCE_HOSTNAME/$TARGET_HOSTNAME/g&lt;BR /&gt;w $FILE&lt;BR /&gt;q&lt;BR /&gt;EOF&lt;BR /&gt;FILE=\0&lt;BR /&gt;fi&lt;BR /&gt;done&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But above doesn't work yet&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2012 21:42:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5505983#M53506</guid>
      <dc:creator>Andres_13</dc:creator>
      <dc:date>2012-01-23T21:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help with find</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5506169#M53507</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="hps"&gt;&amp;gt;find all the files containing the prod server hostname, edit each one of them in order to get all of these files "pointing" to the new virtual server's hostname.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DIR=/u01&lt;BR /&gt;find $DIR -type f | while read file; do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; fgrep -q "$SOURCE_HOSTNAME" $file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if [ $? -eq 0 ]; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sed "s/$SOURCE_HOSTNAME/$TARGET_HOSTNAME/g" $file &amp;gt; $file.new &amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mv $file.new $file&amp;nbsp;&amp;nbsp; # permission &amp;amp; ownership possibly changed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; fi&lt;/P&gt;&lt;P&gt;done&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2012 04:50:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5506169#M53507</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-01-24T04:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help with find</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5506867#M53509</link>
      <description>&lt;P&gt;Thank's for your support dennis, that did the trick!.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2012 15:56:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/5506867#M53509</guid>
      <dc:creator>Andres_13</dc:creator>
      <dc:date>2012-01-24T15:56:29Z</dc:date>
    </item>
  </channel>
</rss>

