<?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 Perl search and replace in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-search-and-replace/m-p/3203178#M714174</link>
    <description>Hi,&lt;BR /&gt;  I have written perl script, which prompts for network parameters and modifies copule of file, one of them is tnanames.ora. I am trying to search and replace in tnsnames.ora:&lt;BR /&gt;&lt;BR /&gt;Current values:&lt;BR /&gt;&lt;BR /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.32.100)(PORT = 1521))&lt;BR /&gt;&lt;BR /&gt;Search and replace with perl script:&lt;BR /&gt;$IN =~ s/\(^ .*\)\(ADDRESS.*\)\(HOST.*\)\(PORT.*\)/\1\2HOST \= $IP_ADDRESS\)\(\4/g;&lt;BR /&gt;&lt;BR /&gt;Perl script does nothing. But if I use the same search and replace within vi it works. &lt;BR /&gt;&lt;BR /&gt;:1,$s/\(^ .*\)\(ADDRESS.*\)\(HOST.*\)\(PORT.*\)/\1\2HOST \= $IP_ADDRESS\)\(\4/g;&lt;BR /&gt;&lt;BR /&gt;Am i missing anything with perl script?&lt;BR /&gt;&lt;BR /&gt;thanks in advance.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 26 Feb 2004 09:50:39 GMT</pubDate>
    <dc:creator>HPP</dc:creator>
    <dc:date>2004-02-26T09:50:39Z</dc:date>
    <item>
      <title>Perl search and replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-search-and-replace/m-p/3203178#M714174</link>
      <description>Hi,&lt;BR /&gt;  I have written perl script, which prompts for network parameters and modifies copule of file, one of them is tnanames.ora. I am trying to search and replace in tnsnames.ora:&lt;BR /&gt;&lt;BR /&gt;Current values:&lt;BR /&gt;&lt;BR /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.32.100)(PORT = 1521))&lt;BR /&gt;&lt;BR /&gt;Search and replace with perl script:&lt;BR /&gt;$IN =~ s/\(^ .*\)\(ADDRESS.*\)\(HOST.*\)\(PORT.*\)/\1\2HOST \= $IP_ADDRESS\)\(\4/g;&lt;BR /&gt;&lt;BR /&gt;Perl script does nothing. But if I use the same search and replace within vi it works. &lt;BR /&gt;&lt;BR /&gt;:1,$s/\(^ .*\)\(ADDRESS.*\)\(HOST.*\)\(PORT.*\)/\1\2HOST \= $IP_ADDRESS\)\(\4/g;&lt;BR /&gt;&lt;BR /&gt;Am i missing anything with perl script?&lt;BR /&gt;&lt;BR /&gt;thanks in advance.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Feb 2004 09:50:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-search-and-replace/m-p/3203178#M714174</guid>
      <dc:creator>HPP</dc:creator>
      <dc:date>2004-02-26T09:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Perl search and replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-search-and-replace/m-p/3203179#M714175</link>
      <description>1. use $1, $2, $3 in the replacement pattern&lt;BR /&gt;2. perl's re's capture with (), not with \(\)&lt;BR /&gt;3. the start of string anchor cannot match after a literal (&lt;BR /&gt;&lt;BR /&gt;so you regex does not capture anything&lt;BR /&gt;&lt;BR /&gt;Enjoy, H.Merijn</description>
      <pubDate>Thu, 26 Feb 2004 10:03:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-search-and-replace/m-p/3203179#M714175</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-02-26T10:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: Perl search and replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-search-and-replace/m-p/3203180#M714176</link>
      <description>Like Procura stated, change your line to:&lt;BR /&gt;&lt;BR /&gt;$IN =~ s/(^.*)(ADDRESS.*)(HOST.*)(PORT.*)/$1$2HOST = $IP_ADDRESS)($4))/g;&lt;BR /&gt;&lt;BR /&gt;You also had a SPACE after the carat (^), which will only match if there is a SPACE in front of "(ADDRESS".&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Thu, 26 Feb 2004 10:15:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-search-and-replace/m-p/3203180#M714176</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2004-02-26T10:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Perl search and replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-search-and-replace/m-p/3203181#M714177</link>
      <description>Merijin,&lt;BR /&gt;   Thanks for the quick response. I made changes to script and its working fine.&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;PAd</description>
      <pubDate>Thu, 26 Feb 2004 10:18:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-search-and-replace/m-p/3203181#M714177</guid>
      <dc:creator>HPP</dc:creator>
      <dc:date>2004-02-26T10:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Perl search and replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-search-and-replace/m-p/3203182#M714178</link>
      <description>Thanks harry.</description>
      <pubDate>Thu, 26 Feb 2004 10:19:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-search-and-replace/m-p/3203182#M714178</guid>
      <dc:creator>HPP</dc:creator>
      <dc:date>2004-02-26T10:19:15Z</dc:date>
    </item>
  </channel>
</rss>

