<?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: Can sed scripts insert new lines? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992957#M124809</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;&amp;lt;&amp;gt;&lt;BR /&gt;gives the attached script to print only one version of any duplicate line&lt;BR /&gt;in a file.&lt;BR /&gt;&lt;BR /&gt;BTW, sed.sourceforge.net is a good source for sed scripts&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;FiX&lt;BR /&gt;</description>
    <pubDate>Wed, 11 Jun 2003 16:37:39 GMT</pubDate>
    <dc:creator>F. X. de Montgolfier</dc:creator>
    <dc:date>2003-06-11T16:37:39Z</dc:date>
    <item>
      <title>Can sed scripts insert new lines?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992953#M124805</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;I'm trying to replace a combination of two lines with some text using sed.  I have a problem when the first line is duplicated as I need sed to insert a newline.  I have tried using \n and \\n to insert the newline in place of my obviously wrong NEWLINE in my attempt below, but it still does not work.&lt;BR /&gt;&lt;BR /&gt;Can anyone help me?&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Paul.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/sed -f&lt;BR /&gt;&lt;BR /&gt;/FirstLine/ {&lt;BR /&gt;   # Read in the next line of input.&lt;BR /&gt;   N&lt;BR /&gt;&lt;BR /&gt;   # Remove Duplicate.&lt;BR /&gt;   /FirstLine\n\(.*FirstLine\)/ {&lt;BR /&gt;      #####################################&lt;BR /&gt;      # The Following Line does not work. #&lt;BR /&gt;      #####################################&lt;BR /&gt;      s/FirstLine\n\(.*FirstLine\)/NEWLINE\1/&lt;BR /&gt;      &lt;BR /&gt;      # Read in the next line of input.&lt;BR /&gt;      N&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;   # Replace the match.&lt;BR /&gt;   s/FirstLine\n.*SecondLine/PERFECT MATCH/&lt;BR /&gt; &lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Jun 2003 05:49:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992953#M124805</guid>
      <dc:creator>Paul Young_4</dc:creator>
      <dc:date>2003-06-10T05:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can sed scripts insert new lines?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992954#M124806</link>
      <description>Hi,&lt;BR /&gt;here is a little suggestion:&lt;BR /&gt;&lt;BR /&gt;Add new line at the middle using some pattern &lt;BR /&gt;&lt;BR /&gt;# sed 's/111/111Z/g' test | tr "111Z" "111\012]" add newline after "111" &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I don't know if it is applicable but it show how to put the newline, using "tr".&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  HTH,&lt;BR /&gt;    Massimo&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Jun 2003 05:55:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992954#M124806</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-06-10T05:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Can sed scripts insert new lines?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992955#M124807</link>
      <description>This is a reply to the tr suggestion.&lt;BR /&gt;&lt;BR /&gt;The tr command does not compare strings, but corresponding position letters in a string.&lt;BR /&gt;&lt;BR /&gt;In the example every "Z" will be replaced with "\012", (every 1 will be replaced with 1)&lt;BR /&gt;&lt;BR /&gt;Not sure it is the desired result</description>
      <pubDate>Tue, 10 Jun 2003 07:54:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992955#M124807</guid>
      <dc:creator>rachel_11</dc:creator>
      <dc:date>2003-06-10T07:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can sed scripts insert new lines?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992956#M124808</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Don't know if you have tried this also...&lt;BR /&gt;&lt;BR /&gt;Give back slash for \n at s/FirstLine\n\(.*FirstLine\)/NEWLINE\1/ ??? &lt;BR /&gt;&lt;BR /&gt;Try &lt;BR /&gt;s/FirstLine\\n\(.*FirstLine\)/NEWLINE\1/ .&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;VJ.</description>
      <pubDate>Wed, 11 Jun 2003 09:55:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992956#M124808</guid>
      <dc:creator>vasundhara</dc:creator>
      <dc:date>2003-06-11T09:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can sed scripts insert new lines?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992957#M124809</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;&amp;lt;&amp;gt;&lt;BR /&gt;gives the attached script to print only one version of any duplicate line&lt;BR /&gt;in a file.&lt;BR /&gt;&lt;BR /&gt;BTW, sed.sourceforge.net is a good source for sed scripts&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;FiX&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Jun 2003 16:37:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992957#M124809</guid>
      <dc:creator>F. X. de Montgolfier</dc:creator>
      <dc:date>2003-06-11T16:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can sed scripts insert new lines?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992958#M124810</link>
      <description>Thankyou all for your replies.  To solve my problem i used your solution (thanks to Massimo and Rachel).&lt;BR /&gt;&lt;BR /&gt;Then i read the link that Fix gave me and I got the nice way i was hoping to do it (so I could use sed for everything).&lt;BR /&gt;&lt;BR /&gt;To put a new line in the replacement string you backslash the line and continue on the following so my line would be:&lt;BR /&gt;&lt;BR /&gt;s/FirstLine\n\(.*FirstLine\)/\1/&lt;BR /&gt;&lt;BR /&gt;Paul.</description>
      <pubDate>Thu, 12 Jun 2003 00:16:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992958#M124810</guid>
      <dc:creator>Paul Young_4</dc:creator>
      <dc:date>2003-06-12T00:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Can sed scripts insert new lines?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992959#M124811</link>
      <description>My last reply didnt work because there must be a formatter here who doesnt like free line space - where you see CR there should be a Carriage Return.&lt;BR /&gt;&lt;BR /&gt;s/FirstLine\n\(.*FirstLine\)/\CR&lt;BR /&gt;\1/ &lt;BR /&gt;&lt;BR /&gt;Paul.</description>
      <pubDate>Thu, 12 Jun 2003 00:28:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-sed-scripts-insert-new-lines/m-p/2992959#M124811</guid>
      <dc:creator>Paul Young_4</dc:creator>
      <dc:date>2003-06-12T00:28:05Z</dc:date>
    </item>
  </channel>
</rss>

