<?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: Remove a comment # from a file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086174#M143744</link>
    <description>Use this perl script to display the file and redirect it as neccesary&lt;BR /&gt;-----------------------------&lt;BR /&gt;&lt;BR /&gt;open I, $ARGV[0] or die "cannot open $ARGV[0]: $!";&lt;BR /&gt;&lt;BR /&gt;while ($line=&lt;I&gt;)&lt;BR /&gt;{&lt;BR /&gt;  next if $line=~ /^#/;&lt;BR /&gt;  print $line;&lt;BR /&gt;}&lt;BR /&gt;------------------------&lt;/I&gt;</description>
    <pubDate>Mon, 06 Oct 2003 15:26:27 GMT</pubDate>
    <dc:creator>Paddy_1</dc:creator>
    <dc:date>2003-10-06T15:26:27Z</dc:date>
    <item>
      <title>Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086167#M143737</link>
      <description>Any one know How to remove a "#" from a file without using vi (using script).&lt;BR /&gt;I think I am half way the problem as I believe I should use ch_rc command, but I am not sure of the syntax.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 06 Oct 2003 11:08:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086167#M143737</guid>
      <dc:creator>Andrew_80</dc:creator>
      <dc:date>2003-10-06T11:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086168#M143738</link>
      <description>Well, there's always sed:&lt;BR /&gt; &lt;BR /&gt;sed 's|#AnyOtherTextNecessaryToIdentifyTheLine||g'`&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;Pete&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Mon, 06 Oct 2003 11:12:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086168#M143738</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-10-06T11:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086169#M143739</link>
      <description>sed 's/#//g' file &amp;gt; new_file&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Sergejs</description>
      <pubDate>Mon, 06 Oct 2003 11:17:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086169#M143739</guid>
      <dc:creator>Sergejs Svitnevs</dc:creator>
      <dc:date>2003-10-06T11:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086170#M143740</link>
      <description>This is OK, But I need to edit a file like&lt;BR /&gt;"/etc/rc.config.d/savecrash" and remove the comments from three lines and the sed allow you to only create it on anew file. So, I am trying to save multiple steps.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 06 Oct 2003 11:34:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086170#M143740</guid>
      <dc:creator>Andrew_80</dc:creator>
      <dc:date>2003-10-06T11:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086171#M143741</link>
      <description>...more&lt;BR /&gt;sed 's/#//n' infile &amp;gt; outfile &lt;BR /&gt;(n=1 to 512). Substitute for just the n'th occurrence.&lt;BR /&gt;Bruno&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Oct 2003 11:46:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086171#M143741</guid>
      <dc:creator>Bruno Ganino</dc:creator>
      <dc:date>2003-10-06T11:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086172#M143742</link>
      <description>grep -v \# file1 &amp;gt; file2</description>
      <pubDate>Mon, 06 Oct 2003 11:52:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086172#M143742</guid>
      <dc:creator>Michael Steele_2</dc:creator>
      <dc:date>2003-10-06T11:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086173#M143743</link>
      <description>see also command ed</description>
      <pubDate>Mon, 06 Oct 2003 12:13:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086173#M143743</guid>
      <dc:creator>Bruno Ganino</dc:creator>
      <dc:date>2003-10-06T12:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086174#M143744</link>
      <description>Use this perl script to display the file and redirect it as neccesary&lt;BR /&gt;-----------------------------&lt;BR /&gt;&lt;BR /&gt;open I, $ARGV[0] or die "cannot open $ARGV[0]: $!";&lt;BR /&gt;&lt;BR /&gt;while ($line=&lt;I&gt;)&lt;BR /&gt;{&lt;BR /&gt;  next if $line=~ /^#/;&lt;BR /&gt;  print $line;&lt;BR /&gt;}&lt;BR /&gt;------------------------&lt;/I&gt;</description>
      <pubDate>Mon, 06 Oct 2003 15:26:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086174#M143744</guid>
      <dc:creator>Paddy_1</dc:creator>
      <dc:date>2003-10-06T15:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086175#M143745</link>
      <description>Remember I just want to remove the '#' from some specific lines not the whole file savecrash.&lt;BR /&gt;&lt;BR /&gt;# SAVECRASH=1&lt;BR /&gt;# SAVECRASH_DIR=/var/adm/crash&lt;BR /&gt;# COMPRESS=2&lt;BR /&gt;&lt;BR /&gt;I know how to change the values using &lt;BR /&gt;&lt;BR /&gt;#ch_rc -a -p &lt;BR /&gt;&lt;BR /&gt;and on the man pages it says you can remove characters also, but I am not sure How ?&lt;BR /&gt;I appreciate your responses.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 07 Oct 2003 08:02:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086175#M143745</guid>
      <dc:creator>Andrew_80</dc:creator>
      <dc:date>2003-10-07T08:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086176#M143746</link>
      <description>mv savecrash savecrash.prev&lt;BR /&gt;cat savecrash.prev | sed s/^#//g &amp;gt; savecrash</description>
      <pubDate>Tue, 07 Oct 2003 08:10:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086176#M143746</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-10-07T08:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086177#M143747</link>
      <description>But that will remove it from all the lines including text !!&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Oct 2003 08:15:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086177#M143747</guid>
      <dc:creator>Andrew_80</dc:creator>
      <dc:date>2003-10-07T08:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086178#M143748</link>
      <description>&lt;BR /&gt;You need to use "vi", "emacs" or "ed". Unless you are a pattern matching expert and know how to write code in perl, your request for another "answer", other than editors, is highly unlikely, especially since you want to have an answer that magically knows which "#" lines to remove or possibly "un-comment" lines and which not to. &lt;BR /&gt;&lt;BR /&gt;If you don't like "vi", then copy the progam to your desktop and use "wordpad".&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Tue, 07 Oct 2003 08:18:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086178#M143748</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2003-10-07T08:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086179#M143749</link>
      <description>Why do'nt you want to use vi ??&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Oct 2003 08:19:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086179#M143749</guid>
      <dc:creator>Robert-Jan Goossens</dc:creator>
      <dc:date>2003-10-07T08:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086180#M143750</link>
      <description>Hi,&lt;BR /&gt; &lt;BR /&gt;I tend to agree with Harry.&lt;BR /&gt; &lt;BR /&gt;In addition, if you just want to get rid of consecutive lines at the beginning or at the end of the file, you can use head and/or tail. For instance, you want the 4th line onwards from the file, then:&lt;BR /&gt; &lt;BR /&gt;# tail +4 myfile &amp;gt; myfile2&lt;BR /&gt; &lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt; &lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Tue, 07 Oct 2003 08:25:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086180#M143750</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2003-10-07T08:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086181#M143751</link>
      <description>My last post only removes the "#" not the text.  It does do it for all lines though.  There is no way that you can be sure you are uncommenting the right thing unless you give the script something to match against.  Now that is going to start to be annoying when uncommenting large files.&lt;BR /&gt; &lt;BR /&gt;If it is something you find you are doing a lot of just make a copy of the file with the comments in and another with the comments out and just cp the one you want when you want.</description>
      <pubDate>Tue, 07 Oct 2003 08:27:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086181#M143751</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-10-07T08:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086182#M143752</link>
      <description>Thanks a lot, The reason I don't want to use vi is that I have to do the same thing across 20 machines !&lt;BR /&gt;&lt;BR /&gt;I will use Mark's solution &lt;BR /&gt;cat savecrash.prev | sed s/^#//g &amp;gt; savecrash&lt;BR /&gt;and specify each line.&lt;BR /&gt;&lt;BR /&gt;Thanks again</description>
      <pubDate>Tue, 07 Oct 2003 08:41:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086182#M143752</guid>
      <dc:creator>Andrew_80</dc:creator>
      <dc:date>2003-10-07T08:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086183#M143753</link>
      <description>If you know which line pattern you want to replace say # SAVECRASH&lt;BR /&gt;then you can use vi&lt;BR /&gt;this way&lt;BR /&gt;create "mycom" a command file :&lt;BR /&gt;:1,$s/^# SAVECRASH/SAVECRASH/&lt;BR /&gt;:wq&lt;BR /&gt;&lt;BR /&gt;then run&lt;BR /&gt;vi &lt;YOURFILENAME&gt; &amp;lt; mycom &amp;gt;/dev/null&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Jean-Luc&lt;/YOURFILENAME&gt;</description>
      <pubDate>Tue, 07 Oct 2003 11:26:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086183#M143753</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2003-10-07T11:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086184#M143754</link>
      <description>Well, try&lt;BR /&gt;cat savecrash | sed s/# SAVECRASH//g &amp;gt; savecrash.tmp&lt;BR /&gt;cat savecrash.tmp | sed s/# COMPRESS//g &amp;gt; savecrash&lt;BR /&gt;&lt;BR /&gt;P.S. option g=globale or n=occorrence&lt;BR /&gt;HTH&lt;BR /&gt;Bruno&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Oct 2003 03:09:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086184#M143754</guid>
      <dc:creator>Bruno Ganino</dc:creator>
      <dc:date>2003-10-08T03:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a comment # from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086185#M143755</link>
      <description>Before not right, This is OK! Sorry&lt;BR /&gt;Well, try&lt;BR /&gt;cat savecrash | sed s/# SAVECRASH/SAVECRASH/g &amp;gt; savecrash.tmp&lt;BR /&gt;cat savecrash.tmp | sed s/# COMPRESS/COMPRESS/g &amp;gt; savecrash&lt;BR /&gt;P.S. option g=globale or n=occorrence&lt;BR /&gt;HTH&lt;BR /&gt;Bruno&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Oct 2003 03:12:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-a-comment-from-a-file/m-p/3086185#M143755</guid>
      <dc:creator>Bruno Ganino</dc:creator>
      <dc:date>2003-10-08T03:12:37Z</dc:date>
    </item>
  </channel>
</rss>

