<?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: Quick Script Command to Find/Insert a line in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343263#M874828</link>
    <description>I cannot thank you enough for all you quick knowledge.  I ended up using Rodney Hills' perl command.  &lt;BR /&gt;&lt;BR /&gt;Tommy</description>
    <pubDate>Wed, 28 Jul 2004 09:24:41 GMT</pubDate>
    <dc:creator>Tommy_6</dc:creator>
    <dc:date>2004-07-28T09:24:41Z</dc:date>
    <item>
      <title>Quick Script Command to Find/Insert a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343258#M874823</link>
      <description>Good Morning eveyrone,&lt;BR /&gt;I'm looking for some quick expertise with sed/awk or anything other command that might work for me.  I need to search a text file for "echo $x", each time "echo $x" is found, I need to insert "echo $y" on the line below it. &lt;BR /&gt;&lt;BR /&gt;Thank you in advance!!!&lt;BR /&gt;&lt;BR /&gt;Tommy</description>
      <pubDate>Wed, 28 Jul 2004 08:22:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343258#M874823</guid>
      <dc:creator>Tommy_6</dc:creator>
      <dc:date>2004-07-28T08:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Command to Find/Insert a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343259#M874824</link>
      <description>How about-&lt;BR /&gt; &lt;BR /&gt;perl -i -n -e 'print $_; print "echo \$y\n" if /^echo \$x/;' yourfile.txt&lt;BR /&gt; &lt;BR /&gt;This will update the file "yourfile.txt" with the additional "echo $y" lines.&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Wed, 28 Jul 2004 08:41:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343259#M874824</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-07-28T08:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Command to Find/Insert a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343260#M874825</link>
      <description>We can do it with sed easily as,&lt;BR /&gt;&lt;BR /&gt; -- test.file --&lt;BR /&gt; itrc forums&lt;BR /&gt; test log entry to test&lt;BR /&gt; HELLO &lt;BR /&gt; bye for now&lt;BR /&gt; test will be thhere&lt;BR /&gt; HELLO&lt;BR /&gt; it is a test for log test&lt;BR /&gt; test over&lt;BR /&gt;&lt;BR /&gt; If you want to put HAI below to HELLO then,&lt;BR /&gt;  &lt;BR /&gt; sed -e 's/^HELLO$/HELLO\&lt;BR /&gt; HAI/g' test.file&lt;BR /&gt; &lt;BR /&gt; It will do that change.</description>
      <pubDate>Wed, 28 Jul 2004 08:59:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343260#M874825</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-07-28T08:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Command to Find/Insert a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343261#M874826</link>
      <description>We can do this using awk program too as,&lt;BR /&gt;&lt;BR /&gt; --- test.log ---&lt;BR /&gt;itrc forums&lt;BR /&gt;test log entry to test&lt;BR /&gt;HELLO&lt;BR /&gt;bye for now&lt;BR /&gt;test will be thhere&lt;BR /&gt;it is a test for log test&lt;BR /&gt;HELLO&lt;BR /&gt;test over&lt;BR /&gt;&lt;BR /&gt; To insert BYE after the pattern HELLO then,&lt;BR /&gt; &lt;BR /&gt; awk '{ if ($0 == "HELLO" print $1 "\nBYE"&lt;BR /&gt;else $0 }' test.log&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Jul 2004 09:05:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343261#M874826</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-07-28T09:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Command to Find/Insert a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343262#M874827</link>
      <description>Why nor even shorter&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e'm/\becho\s*\$x\b/&amp;amp;&amp;amp;s/$/\necho \$y/' your_file&lt;BR /&gt;&lt;BR /&gt;it is even safe against not inserting after 'echo $xb' or after 'becho $x'&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Wed, 28 Jul 2004 09:15:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343262#M874827</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-07-28T09:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Command to Find/Insert a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343263#M874828</link>
      <description>I cannot thank you enough for all you quick knowledge.  I ended up using Rodney Hills' perl command.  &lt;BR /&gt;&lt;BR /&gt;Tommy</description>
      <pubDate>Wed, 28 Jul 2004 09:24:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-command-to-find-insert-a-line/m-p/3343263#M874828</guid>
      <dc:creator>Tommy_6</dc:creator>
      <dc:date>2004-07-28T09:24:41Z</dc:date>
    </item>
  </channel>
</rss>

