<?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 Scripting help, joining two lines in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595855#M884184</link>
    <description>I am requesting a simple sed or awk command that will take a file and join every two lines into one line.  I would like the contents of the 2nd line appended to the first line.&lt;BR /&gt;&lt;BR /&gt;Oct1620018:20AM &lt;BR /&gt; va_q5n&lt;BR /&gt;Oct1620018:17AM&lt;BR /&gt; va_qeq&lt;BR /&gt;Oct1620018:28AM&lt;BR /&gt; va_qv7&lt;BR /&gt;Oct1620018:10AM&lt;BR /&gt; va_rq4&lt;BR /&gt;Oct1620018:19AM&lt;BR /&gt; va_rw1&lt;BR /&gt;</description>
    <pubDate>Tue, 16 Oct 2001 14:49:39 GMT</pubDate>
    <dc:creator>Belinda Dermody</dc:creator>
    <dc:date>2001-10-16T14:49:39Z</dc:date>
    <item>
      <title>Scripting help, joining two lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595855#M884184</link>
      <description>I am requesting a simple sed or awk command that will take a file and join every two lines into one line.  I would like the contents of the 2nd line appended to the first line.&lt;BR /&gt;&lt;BR /&gt;Oct1620018:20AM &lt;BR /&gt; va_q5n&lt;BR /&gt;Oct1620018:17AM&lt;BR /&gt; va_qeq&lt;BR /&gt;Oct1620018:28AM&lt;BR /&gt; va_qv7&lt;BR /&gt;Oct1620018:10AM&lt;BR /&gt; va_rq4&lt;BR /&gt;Oct1620018:19AM&lt;BR /&gt; va_rw1&lt;BR /&gt;</description>
      <pubDate>Tue, 16 Oct 2001 14:49:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595855#M884184</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2001-10-16T14:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help, joining two lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595856#M884185</link>
      <description>As in  all things to do with shell you have several options:&lt;BR /&gt;&lt;BR /&gt;1) paste:&lt;BR /&gt;   paste -s -d " \n" &lt;FILE&gt;&lt;BR /&gt;will join the files with a space between the lines&lt;BR /&gt;&lt;BR /&gt;2) awk&lt;BR /&gt;   awk '{ first=$0; getline; print first $0 }' &lt;FILE&gt;&lt;BR /&gt;&lt;BR /&gt;Potentially you can use pr, join or sed to do this too...&lt;BR /&gt;&lt;BR /&gt;dave&lt;/FILE&gt;&lt;/FILE&gt;</description>
      <pubDate>Tue, 16 Oct 2001 15:01:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595856#M884185</guid>
      <dc:creator>David Lodge</dc:creator>
      <dc:date>2001-10-16T15:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help, joining two lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595857#M884186</link>
      <description>Hi James:&lt;BR /&gt;&lt;BR /&gt;# awk '{if (NR%2==1) {HOLD=$0} else {print HOLD,$0}} END {if (NR&lt;BR /&gt;%2==1) {print HOLD}}' /tmp/myfile &amp;gt; /tmp/myfile.new&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 16 Oct 2001 15:01:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595857#M884186</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-10-16T15:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help, joining two lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595858#M884187</link>
      <description>Thanks David and James, Both awk statements work but I gave David the full points because he was first and his command was less key strokes.&lt;BR /&gt;Once again thanks.</description>
      <pubDate>Tue, 16 Oct 2001 15:17:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595858#M884187</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2001-10-16T15:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help, joining two lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595859#M884188</link>
      <description>Hi James:&lt;BR /&gt;&lt;BR /&gt;How about purely in the shell reading from stdin, outputing to stdout:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;N=0&lt;BR /&gt;SAVE=""&lt;BR /&gt;cat - | while read X&lt;BR /&gt;  do&lt;BR /&gt;     if [ $((${N} % 2)) -eq 0 ]&lt;BR /&gt;       then&lt;BR /&gt;         SAVE=${X}&lt;BR /&gt;       else&lt;BR /&gt;         echo "${SAVE} ${X}"&lt;BR /&gt;       fi&lt;BR /&gt;      N=$((${N} + 1))&lt;BR /&gt;  done&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Tue, 16 Oct 2001 15:18:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595859#M884188</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-10-16T15:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help, joining two lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595860#M884189</link>
      <description>Too complex (for pure shell) :-) try the following:&lt;BR /&gt;&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;   read line2&lt;BR /&gt;   print "${line}${line2}"&lt;BR /&gt;done &lt;FILENAME&gt;&lt;/FILENAME&gt;&lt;BR /&gt;So, can anybody make a shorter version using just builitins?&lt;BR /&gt;&lt;BR /&gt;dave</description>
      <pubDate>Tue, 16 Oct 2001 15:58:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595860#M884189</guid>
      <dc:creator>David Lodge</dc:creator>
      <dc:date>2001-10-16T15:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help, joining two lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595861#M884190</link>
      <description>Ok Gentlemen let's not bicker, all answers are appreciated,  I was currently using the read statement, but just wanted to reduce lines and characters within my script for ease of understanding.    I would rather have one line of code in place of 6-7.</description>
      <pubDate>Tue, 16 Oct 2001 16:55:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-joining-two-lines/m-p/2595861#M884190</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2001-10-16T16:55:13Z</dc:date>
    </item>
  </channel>
</rss>

