<?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: Pattern replacing in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053120#M435129</link>
    <description>&amp;gt;Karsten: sed s/oldpattern/newpattern/ file | tee file&lt;BR /&gt;&lt;BR /&gt;The tee(1) is going to writing to the same file that sed(1) is reading.&lt;BR /&gt;</description>
    <pubDate>Fri, 15 Jun 2007 03:33:36 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2007-06-15T03:33:36Z</dc:date>
    <item>
      <title>Pattern replacing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053116#M435125</link>
      <description>I want to replace OLDPATTERN with NEWPATTERN in some files using scripting without changing the file name. (I don’t want to redirect to another file, I want to do that in same file)&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Thomas&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Jun 2007 23:33:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053116#M435125</guid>
      <dc:creator>M.Thomas</dc:creator>
      <dc:date>2007-06-14T23:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern replacing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053117#M435126</link>
      <description>&lt;!--!*#--&gt;for _file in file1 file2 file3 ...&lt;BR /&gt;do&lt;BR /&gt;   perl -pi -e 's/OLDPATTERN/NEWPATTERN/g' ${_file}&lt;BR /&gt;done</description>
      <pubDate>Fri, 15 Jun 2007 02:30:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053117#M435126</guid>
      <dc:creator>Suraj Singh_1</dc:creator>
      <dc:date>2007-06-15T02:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern replacing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053118#M435127</link>
      <description>Or in a single line:&lt;BR /&gt;&lt;BR /&gt;perl -pi -e 's/OLDPATTERN/NEWPATTERN/g' file1 file2 file3 ...</description>
      <pubDate>Fri, 15 Jun 2007 02:33:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053118#M435127</guid>
      <dc:creator>Suraj Singh_1</dc:creator>
      <dc:date>2007-06-15T02:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern replacing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053119#M435128</link>
      <description>Hello Thomas,&lt;BR /&gt;&lt;BR /&gt;try this on a posix-shell:&lt;BR /&gt;&lt;BR /&gt;sed s/oldpattern/newpattern/ file | tee file&lt;BR /&gt;&lt;BR /&gt;After applying the sed command file should be contain the newpattern. But remember it is just a single line substitution.&lt;BR /&gt;&lt;BR /&gt;Greetings &lt;BR /&gt;Karsten</description>
      <pubDate>Fri, 15 Jun 2007 03:24:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053119#M435128</guid>
      <dc:creator>Karsten Löperick</dc:creator>
      <dc:date>2007-06-15T03:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern replacing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053120#M435129</link>
      <description>&amp;gt;Karsten: sed s/oldpattern/newpattern/ file | tee file&lt;BR /&gt;&lt;BR /&gt;The tee(1) is going to writing to the same file that sed(1) is reading.&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Jun 2007 03:33:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053120#M435129</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-15T03:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern replacing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053121#M435130</link>
      <description>Hi Dennis, Thomas&lt;BR /&gt;&lt;BR /&gt;thats right- if you want to shorten the sed script a bit, you can of course remove the filename after the tee command.&lt;BR /&gt;sed ... | tee its enough.&lt;BR /&gt;&lt;BR /&gt;Greetings&lt;BR /&gt;Karsten</description>
      <pubDate>Fri, 15 Jun 2007 03:40:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053121#M435130</guid>
      <dc:creator>Karsten Löperick</dc:creator>
      <dc:date>2007-06-15T03:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern replacing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053122#M435131</link>
      <description>&amp;gt;Karsten: if you want to shorten the sed script a bit, ... remove the filename after the tee&lt;BR /&gt;&lt;BR /&gt;I'm not sure of your point but my point was that you can't use tee(1).  You must write to a new file.  And if you remove the file name after tee(1), why use tee(1)?</description>
      <pubDate>Fri, 15 Jun 2007 03:58:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053122#M435131</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-15T03:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern replacing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053123#M435132</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Thanks for your quick response&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Thomas</description>
      <pubDate>Fri, 15 Jun 2007 04:16:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053123#M435132</guid>
      <dc:creator>M.Thomas</dc:creator>
      <dc:date>2007-06-15T04:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern replacing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053124#M435133</link>
      <description>Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;hmm - it works fine for me in both ways. I do the sed with the file - and then reading the same file with more/cat. Everything is replaced in the same file without any redirection ( see man tee - the tee command transcribes the standard input to the standard output and makes copies in the files )&lt;BR /&gt;&lt;BR /&gt;Greetings&lt;BR /&gt;&lt;BR /&gt;Karsten</description>
      <pubDate>Fri, 15 Jun 2007 04:18:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053124#M435133</guid>
      <dc:creator>Karsten Löperick</dc:creator>
      <dc:date>2007-06-15T04:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern replacing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053125#M435134</link>
      <description>&amp;gt;Karsten: ... Everything is replaced in the same file without any redirection (the tee command transcribes the standard input to the standard output and makes copies in the files)&lt;BR /&gt;&lt;BR /&gt;I'm suggesting it may not work depending on the size of the file and the size of the stdio buffers and how many chars you are inserting/deleting with sed.  In general, writing to the file you're reading isn't a good idea.  Especially by separate processes that don't know this is occurring.</description>
      <pubDate>Fri, 15 Jun 2007 04:41:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-replacing/m-p/5053125#M435134</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-15T04:41:51Z</dc:date>
    </item>
  </channel>
</rss>

