<?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 text between lines in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/insert-text-between-lines/m-p/4741805#M43388</link>
    <description>&lt;!--!*#--&gt;Not a very useful description of what you&lt;BR /&gt;wish to do.  Should "my text" be added at the&lt;BR /&gt;beginning of an existing line?  On a new line&lt;BR /&gt;of its own?  Is "my text" always only one&lt;BR /&gt;line of text (a constant or variable), or&lt;BR /&gt;might it be the contents of some other file?&lt;BR /&gt;&lt;BR /&gt;What is the "certain text" in this "Example"?&lt;BR /&gt;Is it the whole line, or some part of a line?&lt;BR /&gt;&lt;BR /&gt;"sed" can do some useful things.  For&lt;BR /&gt;example:&lt;BR /&gt;&lt;BR /&gt;dyi # cat text.txt&lt;BR /&gt;abc def&lt;BR /&gt;ghi jkl&lt;BR /&gt;mno pqr&lt;BR /&gt;stu vwx&lt;BR /&gt;&lt;BR /&gt;dyi # sed -n -e '1,/hi/p' text.txt&lt;BR /&gt;abc def&lt;BR /&gt;ghi jkl&lt;BR /&gt;&lt;BR /&gt;dyi # sed -n -e '1,/hi/d' -e p text.txt&lt;BR /&gt;mno pqr&lt;BR /&gt;stu vwx&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;      man sed</description>
    <pubDate>Fri, 21 Jan 2011 04:49:38 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2011-01-21T04:49:38Z</dc:date>
    <item>
      <title>insert text between lines</title>
      <link>https://community.hpe.com/t5/operating-system-linux/insert-text-between-lines/m-p/4741804#M43387</link>
      <description>Hi there&lt;BR /&gt;I need to know how to insert a text into existing file, just before certain text.&lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt;echo "my text" &amp;gt;&amp;gt; myfile.conf&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cat myfile.conf&lt;BR /&gt;&lt;BR /&gt;line 1&lt;BR /&gt;line 2&lt;BR /&gt;&lt;BR /&gt;my text&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;# AMAVISD-NEW&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Peter&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Jan 2011 01:32:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/insert-text-between-lines/m-p/4741804#M43387</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-01-21T01:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: insert text between lines</title>
      <link>https://community.hpe.com/t5/operating-system-linux/insert-text-between-lines/m-p/4741805#M43388</link>
      <description>&lt;!--!*#--&gt;Not a very useful description of what you&lt;BR /&gt;wish to do.  Should "my text" be added at the&lt;BR /&gt;beginning of an existing line?  On a new line&lt;BR /&gt;of its own?  Is "my text" always only one&lt;BR /&gt;line of text (a constant or variable), or&lt;BR /&gt;might it be the contents of some other file?&lt;BR /&gt;&lt;BR /&gt;What is the "certain text" in this "Example"?&lt;BR /&gt;Is it the whole line, or some part of a line?&lt;BR /&gt;&lt;BR /&gt;"sed" can do some useful things.  For&lt;BR /&gt;example:&lt;BR /&gt;&lt;BR /&gt;dyi # cat text.txt&lt;BR /&gt;abc def&lt;BR /&gt;ghi jkl&lt;BR /&gt;mno pqr&lt;BR /&gt;stu vwx&lt;BR /&gt;&lt;BR /&gt;dyi # sed -n -e '1,/hi/p' text.txt&lt;BR /&gt;abc def&lt;BR /&gt;ghi jkl&lt;BR /&gt;&lt;BR /&gt;dyi # sed -n -e '1,/hi/d' -e p text.txt&lt;BR /&gt;mno pqr&lt;BR /&gt;stu vwx&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;      man sed</description>
      <pubDate>Fri, 21 Jan 2011 04:49:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/insert-text-between-lines/m-p/4741805#M43388</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-01-21T04:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: insert text between lines</title>
      <link>https://community.hpe.com/t5/operating-system-linux/insert-text-between-lines/m-p/4741806#M43389</link>
      <description>Should "my text" be added at the&lt;BR /&gt;beginning of an existing line?&lt;BR /&gt;&lt;BR /&gt;Yes,just before:  &lt;BR /&gt;#&lt;BR /&gt;# AMAVISD-NEW&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;Is "my text" always only one&lt;BR /&gt;line of text (a constant or variable), or&lt;BR /&gt;might it be the contents of some other file?&lt;BR /&gt;&lt;BR /&gt;It's just one line - constant.</description>
      <pubDate>Fri, 21 Jan 2011 06:10:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/insert-text-between-lines/m-p/4741806#M43389</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-01-21T06:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: insert text between lines</title>
      <link>https://community.hpe.com/t5/operating-system-linux/insert-text-between-lines/m-p/4741807#M43390</link>
      <description>Hello.&lt;BR /&gt;&lt;BR /&gt;You can use 'sed', namely the 'i\' and 'a\' (GNU extensions) commands.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Goran</description>
      <pubDate>Fri, 21 Jan 2011 06:12:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/insert-text-between-lines/m-p/4741807#M43390</guid>
      <dc:creator>Goran Koruga</dc:creator>
      <dc:date>2011-01-21T06:12:37Z</dc:date>
    </item>
  </channel>
</rss>

