<?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: insert # in a file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219049#M679108</link>
    <description>Great tips, thx</description>
    <pubDate>Thu, 14 Jan 2010 15:36:00 GMT</pubDate>
    <dc:creator>T. M. Louah</dc:creator>
    <dc:date>2010-01-14T15:36:00Z</dc:date>
    <item>
      <title>insert # in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219041#M679100</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I have a text file that has hundreds of line. I need to comment out the first 150 lines by adding a "#".&lt;BR /&gt;&lt;BR /&gt;Can someone let me know how do it in one shot. &lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Wed, 13 Jan 2010 16:38:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219041#M679100</guid>
      <dc:creator>rhansen</dc:creator>
      <dc:date>2010-01-13T16:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: insert # in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219042#M679101</link>
      <description>How about&lt;BR /&gt;&lt;BR /&gt;cat &lt;FILE&gt; | sed s'/.*/#&amp;amp;/' &amp;gt;&amp;gt; &lt;NEWFILE&gt;&lt;BR /&gt;&lt;BR /&gt;Rita&lt;/NEWFILE&gt;&lt;/FILE&gt;</description>
      <pubDate>Wed, 13 Jan 2010 16:42:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219042#M679101</guid>
      <dc:creator>Rita C Workman</dc:creator>
      <dc:date>2010-01-13T16:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: insert # in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219043#M679102</link>
      <description>oops sorry ignored the 150 lines..&lt;BR /&gt;&lt;BR /&gt;how about...&lt;BR /&gt;&lt;BR /&gt;sed -n '1,150p' &lt;FILE&gt; | sed s'/.*/#&amp;amp;/' &amp;gt;&amp;gt; &lt;NEWFILE&gt;&lt;BR /&gt;&lt;BR /&gt;/Rita&lt;/NEWFILE&gt;&lt;/FILE&gt;</description>
      <pubDate>Wed, 13 Jan 2010 16:52:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219043#M679102</guid>
      <dc:creator>Rita C Workman</dc:creator>
      <dc:date>2010-01-13T16:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: insert # in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219044#M679103</link>
      <description>sed '1,150s/^/#/' file &amp;gt; newfile</description>
      <pubDate>Wed, 13 Jan 2010 16:59:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219044#M679103</guid>
      <dc:creator>Sagar Sirdesai</dc:creator>
      <dc:date>2010-01-13T16:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: insert # in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219045#M679104</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If you prefer 'sed', Sagar's solution is good.&lt;BR /&gt;&lt;BR /&gt;IF you want to use Perl and update the file in-place while preserving a backup copy as ".old", you could do:&lt;BR /&gt;&lt;BR /&gt;# perl -pi.old -e '1..150 and s/^/#/' file&lt;BR /&gt;&lt;BR /&gt;The GNU 'sed' also offers in in-place file update.  HP's 'sed' does not.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 13 Jan 2010 17:26:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219045#M679104</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-01-13T17:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: insert # in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219046#M679105</link>
      <description>&lt;!--!*#--&gt;&amp;gt; [...] update the file in-place [...]&lt;BR /&gt;&lt;BR /&gt;Of course, if you'd like to check the work&lt;BR /&gt;before replacing the original file, then&lt;BR /&gt;in-place may not be the ideal method to use.</description>
      <pubDate>Wed, 13 Jan 2010 23:20:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219046#M679105</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2010-01-13T23:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: insert # in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219047#M679106</link>
      <description>&amp;gt;I need to comment out the first 150 lines by adding a "#".&lt;BR /&gt;&lt;BR /&gt;If you are only doing it once, you can use vi, similar to Sagar's sed:&lt;BR /&gt;:1,150s/^/#/</description>
      <pubDate>Thu, 14 Jan 2010 04:24:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219047#M679106</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-01-14T04:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: insert # in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219048#M679107</link>
      <description>here is a solution with awk:&lt;BR /&gt;&lt;BR /&gt;awk '{if (NR &amp;lt; 151) print "#"$0; else print $0}' filename&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Jan 2010 13:29:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219048#M679107</guid>
      <dc:creator>Viktor Balogh</dc:creator>
      <dc:date>2010-01-14T13:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: insert # in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219049#M679108</link>
      <description>Great tips, thx</description>
      <pubDate>Thu, 14 Jan 2010 15:36:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219049#M679108</guid>
      <dc:creator>T. M. Louah</dc:creator>
      <dc:date>2010-01-14T15:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: insert # in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219050#M679109</link>
      <description>Thanks for the replies.</description>
      <pubDate>Thu, 14 Jan 2010 21:44:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219050#M679109</guid>
      <dc:creator>rhansen</dc:creator>
      <dc:date>2010-01-14T21:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: insert # in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219051#M679110</link>
      <description>Hi rhansen,&lt;BR /&gt;&lt;BR /&gt;I hope we deserve some for our answers.&lt;BR /&gt;We encourge you to assign points &lt;BR /&gt;&lt;BR /&gt;Sagar</description>
      <pubDate>Wed, 20 Jan 2010 05:59:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/insert-in-a-file/m-p/5219051#M679110</guid>
      <dc:creator>Sagar Sirdesai</dc:creator>
      <dc:date>2010-01-20T05:59:32Z</dc:date>
    </item>
  </channel>
</rss>

