<?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 shell script help!! in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2721830#M948121</link>
    <description>Hi guys.&lt;BR /&gt;about 500 files exists&lt;BR /&gt;and I have to insert strings to those files..&lt;BR /&gt;&lt;BR /&gt;How can I replace the strings all files..&lt;BR /&gt;&lt;BR /&gt;See attached files..&lt;BR /&gt;</description>
    <pubDate>Sat, 11 May 2002 03:10:11 GMT</pubDate>
    <dc:creator>mw_4</dc:creator>
    <dc:date>2002-05-11T03:10:11Z</dc:date>
    <item>
      <title>shell script help!!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2721830#M948121</link>
      <description>Hi guys.&lt;BR /&gt;about 500 files exists&lt;BR /&gt;and I have to insert strings to those files..&lt;BR /&gt;&lt;BR /&gt;How can I replace the strings all files..&lt;BR /&gt;&lt;BR /&gt;See attached files..&lt;BR /&gt;</description>
      <pubDate>Sat, 11 May 2002 03:10:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2721830#M948121</guid>
      <dc:creator>mw_4</dc:creator>
      <dc:date>2002-05-11T03:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help!!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2721831#M948122</link>
      <description>Have a for loop to list all of the files you want to edit.  In the for loop, run sed to add the syntax and redirect the output.  Then rename the redirected output to the file you want.&lt;BR /&gt;&lt;BR /&gt;Something like this...&lt;BR /&gt;(NOTE, I would reccommend testing before running.  I am operating off of memory, which is falible.)&lt;BR /&gt;&lt;BR /&gt;for file in `ls *.db`&lt;BR /&gt;do&lt;BR /&gt;  sed '/\@ IN SOA/{x;s/^\$TTL 86400/;G;}' $file &amp;gt; $file.new&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;If you are brave, you could tuck in a move statement to replace the old files with the new one in the for loop.  I would suggest making sure that the output is what you expect before doing so, however.&lt;BR /&gt;&lt;BR /&gt;Like I said before.  I am doing this from memory, so test the sed command against a sample file and redirect the output someplace neutral before running the command against all 500 files.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 11 May 2002 03:29:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2721831#M948122</guid>
      <dc:creator>Zach Parker</dc:creator>
      <dc:date>2002-05-11T03:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help!!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2721832#M948123</link>
      <description>Whoops, typo, should be another forward slash:&lt;BR /&gt; sed '/\@ IN SOA/{x;s/^/\$TTL 86400/;G;}' $file &amp;gt; $file.new &lt;BR /&gt;&lt;BR /&gt;A quick Google check confirms that the syntax should work.</description>
      <pubDate>Sat, 11 May 2002 03:48:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2721832#M948123</guid>
      <dc:creator>Zach Parker</dc:creator>
      <dc:date>2002-05-11T03:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help!!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2721833#M948124</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I would use the same for loop&lt;BR /&gt;&lt;BR /&gt;but I would use a combination of sed and tr :&lt;BR /&gt;&lt;BR /&gt;for inputfile in `ls *.txt`&lt;BR /&gt;do&lt;BR /&gt;sed 's/\@ IN SOA/\$TTL 86400=&amp;amp;/g' ${inputfile} | tr "=" "\n" &amp;gt; ${inputfile}.out&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shabu</description>
      <pubDate>Sat, 11 May 2002 05:29:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2721833#M948124</guid>
      <dc:creator>SHABU KHAN</dc:creator>
      <dc:date>2002-05-11T05:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help!!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2721834#M948125</link>
      <description>perl -pi -e '/^\@ IN SOA/&amp;amp;&amp;amp;s/^/$TTL 86400\n/' *</description>
      <pubDate>Sat, 11 May 2002 06:29:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2721834#M948125</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-05-11T06:29:46Z</dc:date>
    </item>
  </channel>
</rss>

