<?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: script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883167#M935147</link>
    <description>Hi Michael,&lt;BR /&gt;&lt;BR /&gt;Assuming all .txt files in the dir need the change you can use the following sed script&lt;BR /&gt;&lt;BR /&gt;for x in `ls /usr/*.txt`&lt;BR /&gt;&amp;gt;do&lt;BR /&gt;&amp;gt;sed 's/"1992-2002"/"1992-2003"/g' $x &amp;gt; $x.new&lt;BR /&gt;&amp;gt;done&lt;BR /&gt;&lt;BR /&gt;The g (global) is required to catch all instances in the file. Without it only the first occurence gets the change&lt;BR /&gt;&lt;BR /&gt;If you don't wish to keep the old copies add this after the sed command&lt;BR /&gt;&amp;gt;mv $x.new $x&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Jeff&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 16 Jan 2003 01:27:53 GMT</pubDate>
    <dc:creator>Jeff Schussele</dc:creator>
    <dc:date>2003-01-16T01:27:53Z</dc:date>
    <item>
      <title>script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883165#M935145</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;There are many .txt files in /usr directory,&lt;BR /&gt;each file has a line with this content: 1992-2002, I want to change it to 1992-2003 by one time, how should I do? thanks.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Jan 2003 01:11:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883165#M935145</guid>
      <dc:creator>Michael_33</dc:creator>
      <dc:date>2003-01-16T01:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883166#M935146</link>
      <description>either vi each file, then&lt;BR /&gt;type ":0,$s/1992-2002/1992-2003/g&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;cp a.txt a.txt.save&lt;BR /&gt;sed -e "s/1992-2002/1992-2003/" a.txt.save &amp;gt; a.txt&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Jan 2003 01:26:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883166#M935146</guid>
      <dc:creator>Wilfred Chau_1</dc:creator>
      <dc:date>2003-01-16T01:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883167#M935147</link>
      <description>Hi Michael,&lt;BR /&gt;&lt;BR /&gt;Assuming all .txt files in the dir need the change you can use the following sed script&lt;BR /&gt;&lt;BR /&gt;for x in `ls /usr/*.txt`&lt;BR /&gt;&amp;gt;do&lt;BR /&gt;&amp;gt;sed 's/"1992-2002"/"1992-2003"/g' $x &amp;gt; $x.new&lt;BR /&gt;&amp;gt;done&lt;BR /&gt;&lt;BR /&gt;The g (global) is required to catch all instances in the file. Without it only the first occurence gets the change&lt;BR /&gt;&lt;BR /&gt;If you don't wish to keep the old copies add this after the sed command&lt;BR /&gt;&amp;gt;mv $x.new $x&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Jeff&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Jan 2003 01:27:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883167#M935147</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2003-01-16T01:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883168#M935148</link>
      <description>Assumption made .. all of your text files are in /usr level.&lt;BR /&gt;# cd /usr&lt;BR /&gt;# for i in $(ls *.txt)&lt;BR /&gt;&amp;gt; do&lt;BR /&gt;&amp;gt; sed 's/1992-2002/1992-2003/g' $i &amp;gt; $i.new&lt;BR /&gt;&amp;gt; mv $i.new $i&lt;BR /&gt;&amp;gt; done&lt;BR /&gt;#&lt;BR /&gt;That should do it. Test it first by copying a few *.txt files in /tmp and run it from there.</description>
      <pubDate>Thu, 16 Jan 2003 01:30:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883168#M935148</guid>
      <dc:creator>S.K. Chan</dc:creator>
      <dc:date>2003-01-16T01:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883169#M935149</link>
      <description>thanks all!</description>
      <pubDate>Thu, 16 Jan 2003 01:40:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883169#M935149</guid>
      <dc:creator>Michael_33</dc:creator>
      <dc:date>2003-01-16T01:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883170#M935150</link>
      <description>Just for the record, perl can do it in a single op with in-file editing:&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e's/1992-2002/1992-2003/g' *.txt</description>
      <pubDate>Thu, 16 Jan 2003 10:34:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2883170#M935150</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-01-16T10:34:35Z</dc:date>
    </item>
  </channel>
</rss>

