<?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: join lines in a file using getline in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092220#M688916</link>
    <description>hence delete all empty line before concatenate:&lt;BR /&gt;&lt;BR /&gt;sed '/^$/d;$!N;s/\n/ /' file</description>
    <pubDate>Tue, 12 Feb 2008 15:07:49 GMT</pubDate>
    <dc:creator>Oviwan</dc:creator>
    <dc:date>2008-02-12T15:07:49Z</dc:date>
    <item>
      <title>join lines in a file using getline</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092216#M688912</link>
      <description>I want to use awk (although there are many other ways) to join two lines in a file:&lt;BR /&gt;&lt;BR /&gt;my data&lt;BR /&gt;some more data&lt;BR /&gt;&lt;BR /&gt;my data&lt;BR /&gt;some more data&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I want the output like&lt;BR /&gt;&lt;BR /&gt;my data some more data&lt;BR /&gt;my data some more data&lt;BR /&gt;&lt;BR /&gt;I have been looking at using the getline function to do this but I cannot quite get the systax&lt;BR /&gt;&lt;BR /&gt;anyone know the best solution using awk?&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;&lt;BR /&gt;Chris.&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Feb 2008 14:33:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092216#M688912</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-02-12T14:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: join lines in a file using getline</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092217#M688913</link>
      <description>hey&lt;BR /&gt;&lt;BR /&gt;sed solution:&lt;BR /&gt;&lt;BR /&gt;sed '$!N;s/\n/ /' filename&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Tue, 12 Feb 2008 14:38:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092217#M688913</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2008-02-12T14:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: join lines in a file using getline</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092218#M688914</link>
      <description>ok so this works on a single line file but not a file with multiple lines&lt;BR /&gt;&lt;BR /&gt;s:-(&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# cat chris1&lt;BR /&gt;this is the start&lt;BR /&gt;and this is the end&lt;BR /&gt;&lt;BR /&gt;this is the start&lt;BR /&gt;and this is the end&lt;BR /&gt;&lt;BR /&gt;this is the start&lt;BR /&gt;and this is the end&lt;BR /&gt;&lt;BR /&gt;#sed '$!N;s/\n/ /' chris1&lt;BR /&gt;this is the start and this is the end&lt;BR /&gt; this is the start&lt;BR /&gt;and this is the end&lt;BR /&gt;this is the start and this is the end&lt;BR /&gt;&lt;BR /&gt;or my awk effort:&lt;BR /&gt;&lt;BR /&gt;# awk '{printf $0;getline;print " "$0}' chris1&lt;BR /&gt;this is the start and this is the end&lt;BR /&gt; this is the start&lt;BR /&gt;and this is the end&lt;BR /&gt;this is the start and this is the end&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I wil keep trying ....</description>
      <pubDate>Tue, 12 Feb 2008 14:58:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092218#M688914</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-02-12T14:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: join lines in a file using getline</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092219#M688915</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;# awk '{if (NR%2==1) {getline X};print $0,X}' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 12 Feb 2008 15:03:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092219#M688915</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-02-12T15:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: join lines in a file using getline</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092220#M688916</link>
      <description>hence delete all empty line before concatenate:&lt;BR /&gt;&lt;BR /&gt;sed '/^$/d;$!N;s/\n/ /' file</description>
      <pubDate>Tue, 12 Feb 2008 15:07:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092220#M688916</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2008-02-12T15:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: join lines in a file using getline</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092221#M688917</link>
      <description>hi james,&lt;BR /&gt;&lt;BR /&gt;still the same output from your command:&lt;BR /&gt;&lt;BR /&gt;[root@brli013a tmp]# awk '{if (NR%2==1) {getline X};print $0,X}' chris1&lt;BR /&gt;this is the start and this is the end&lt;BR /&gt; this is the start&lt;BR /&gt;and this is the end&lt;BR /&gt;this is the start and this is the end&lt;BR /&gt; and this is the end&lt;BR /&gt;&lt;BR /&gt;but the sed example is good ....</description>
      <pubDate>Tue, 12 Feb 2008 15:54:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092221#M688917</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-02-12T15:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: join lines in a file using getline</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092222#M688918</link>
      <description>Hi (again) Chris:&lt;BR /&gt;&lt;BR /&gt;Oh, so the blank lines were really there...&lt;BR /&gt;&lt;BR /&gt;# awk '/^[[:space:]]*$/ {next};{if (i==0) {getline X;i=1};i=0;print $0,X}' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 12 Feb 2008 16:06:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092222#M688918</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-02-12T16:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: join lines in a file using getline</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092223#M688919</link>
      <description>brilliant thanks both,&lt;BR /&gt;&lt;BR /&gt;and james you have given me a solution 2 for the price of 1, I amended the original file so no lines and it works ( of course )&lt;BR /&gt;&lt;BR /&gt;[root@brli013a tmp]# awk '{if (NR%2==1) {getline X};print $0,X}' chris1&lt;BR /&gt;this is the start and this is the end&lt;BR /&gt;this is the start and this is the end&lt;BR /&gt;this is the start and this is the end&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;and the second solution also works well.&lt;BR /&gt;&lt;BR /&gt;Chris.</description>
      <pubDate>Tue, 12 Feb 2008 16:25:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092223#M688919</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-02-12T16:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: join lines in a file using getline</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092224#M688920</link>
      <description>Hi (again) Chris:&lt;BR /&gt;&lt;BR /&gt;The last suggestion of mine had extraneous (useless) code embedded,  It should simply be:&lt;BR /&gt;&lt;BR /&gt;# awk '/^[[:space:]]*$/ {next};{getline X;print $0,X}' file&lt;BR /&gt;&lt;BR /&gt;NO POINTS FOR THE CORRECTION.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 12 Feb 2008 20:36:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092224#M688920</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-02-12T20:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: join lines in a file using getline</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092225#M688921</link>
      <description>&lt;!--!*#--&gt;Hi&lt;BR /&gt;&lt;BR /&gt;I have a problem similar to the one above. But, in my case the file is of this format.&lt;BR /&gt;---&lt;BR /&gt;line1.1&lt;BR /&gt;line1.2&lt;BR /&gt;line1.3&lt;BR /&gt;&lt;BR /&gt;line2.1&lt;BR /&gt;line2.2&lt;BR /&gt;line2.3&lt;BR /&gt;line2.4&lt;BR /&gt;&lt;BR /&gt;line3.1&lt;BR /&gt;line3.2&lt;BR /&gt;---&lt;BR /&gt;I want the following output&lt;BR /&gt;---&lt;BR /&gt;line1.1line1.2line1.3&lt;BR /&gt;&lt;BR /&gt;line2.1line2.2line2.3line2.4&lt;BR /&gt;&lt;BR /&gt;line3.1line3.2&lt;BR /&gt;---&lt;BR /&gt;So, basically I've to join the lines until a empty line is encountered. Then , i have to skip it and start joining other lines. I am unable to do it with my limited knowledge of awk.&lt;BR /&gt;Any help is appreciated.&lt;BR /&gt;Thanks&lt;BR /&gt;Saini&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Nov 2008 22:51:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/join-lines-in-a-file-using-getline/m-p/5092225#M688921</guid>
      <dc:creator>Saini</dc:creator>
      <dc:date>2008-11-11T22:51:13Z</dc:date>
    </item>
  </channel>
</rss>

