<?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: PERL one-liner help needed (text search and replace) in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008072#M98959</link>
    <description>Hi (again() Mel:&lt;BR /&gt;&lt;BR /&gt;Ooops!  I dropped the "-" in fron of the "-p" switch:&lt;BR /&gt;&lt;BR /&gt;# perl -pi.old -e 's/PRM_RMTCONF=\d\b/PRM_RMTCONF=0/' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
    <pubDate>Wed, 11 Oct 2006 12:50:34 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2006-10-11T12:50:34Z</dc:date>
    <item>
      <title>PERL one-liner help needed (text search and replace)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008069#M98956</link>
      <description>Since I have never got to master perl, I am lost here. So I will not even make an attempt at this one liner&lt;BR /&gt;&lt;BR /&gt;All I want from this one liner is to replace a portion of a line in a given file. To be more specific, I need to disable the prm daemon on 50+ servers. To do this, I need to change the the line &lt;BR /&gt;&lt;BR /&gt;PRM_RMTCONF=1&lt;BR /&gt;&lt;BR /&gt;to&lt;BR /&gt;&lt;BR /&gt;PRM_RMTCONF=0&lt;BR /&gt;&lt;BR /&gt;So, what I am expecting from this one-liner is to look for the line, containing PRM_RMTCONF string and replce the value after the "=" to 0 (zero) regardless if it is 1 or 0 in the file /etc/rc/config.d/prm&lt;BR /&gt;&lt;BR /&gt;It needs to be a one-liner because I want to launch it from a trusted management server via ssh and run it in a command line using a non-interactive session.&lt;BR /&gt;&lt;BR /&gt;I know perl is created situations like this but I do not know how to attack this problem. &lt;BR /&gt;&lt;BR /&gt;Help is greatly appreciated.</description>
      <pubDate>Wed, 11 Oct 2006 12:33:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008069#M98956</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2006-10-11T12:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: PERL one-liner help needed (text search and replace)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008070#M98957</link>
      <description>Hi Mel:&lt;BR /&gt;&lt;BR /&gt;# perl -pi.old e 's/PRM_RMTCONF=\d\b/PRM_RMTCONF=0/' file&lt;BR /&gt;&lt;BR /&gt;...This will substitute PRM_RMTCONF=&lt;DIGIT&gt; with PRM_RMTCONF=0. The old version of the input file will be retained as "file.old" and the new editted version remain as "file".  This is an inplace update.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/DIGIT&gt;</description>
      <pubDate>Wed, 11 Oct 2006 12:43:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008070#M98957</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-10-11T12:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: PERL one-liner help needed (text search and replace)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008071#M98958</link>
      <description>It's very easy using -i and -p.&lt;BR /&gt;&lt;BR /&gt;perl -p -i -e 's/PRM_RMTCONF=1/PRM_RMTCONF=0/' myfile&lt;BR /&gt;&lt;BR /&gt;This will modify "myfile" in place.&lt;BR /&gt;&lt;BR /&gt;If you like you can add an argment to the -i switch:&lt;BR /&gt;&lt;BR /&gt;perl -p -i.old -e 's/PRM_RMTCONF=1/PRM_RMTCONF=0/' myfile&lt;BR /&gt;&lt;BR /&gt;and this has the effect of making a backup file myfile.old while the modified file, myfile, is rewritten.&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Oct 2006 12:48:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008071#M98958</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-10-11T12:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: PERL one-liner help needed (text search and replace)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008072#M98959</link>
      <description>Hi (again() Mel:&lt;BR /&gt;&lt;BR /&gt;Ooops!  I dropped the "-" in fron of the "-p" switch:&lt;BR /&gt;&lt;BR /&gt;# perl -pi.old -e 's/PRM_RMTCONF=\d\b/PRM_RMTCONF=0/' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Oct 2006 12:50:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008072#M98959</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-10-11T12:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: PERL one-liner help needed (text search and replace)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008073#M98960</link>
      <description>imho...here's an ex solution in case you're interested:&lt;BR /&gt;&lt;BR /&gt;# ex -s +"/^PRM_RMTCONF=/s/[0-9]*$/0/ | wq" /etc/rc.config.d/prm</description>
      <pubDate>Wed, 11 Oct 2006 12:55:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008073#M98960</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-10-11T12:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: PERL one-liner help needed (text search and replace)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008074#M98961</link>
      <description>Thanks for all of the responses. PERL one-liners worked like charm.</description>
      <pubDate>Wed, 11 Oct 2006 12:57:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-one-liner-help-needed-text-search-and-replace/m-p/5008074#M98961</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2006-10-11T12:57:23Z</dc:date>
    </item>
  </channel>
</rss>

