<?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: Scripting help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347237#M191771</link>
    <description>Check out the join command</description>
    <pubDate>Mon, 02 Aug 2004 13:48:17 GMT</pubDate>
    <dc:creator>Rick Garland</dc:creator>
    <dc:date>2004-08-02T13:48:17Z</dc:date>
    <item>
      <title>Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347236#M191770</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I want to combine two lines into one line&lt;BR /&gt;&lt;BR /&gt;LABEL1:some output&lt;BR /&gt;LABEL2:some output&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;Want to print like&lt;BR /&gt;LABEL1:output LABEL2: output&lt;BR /&gt;&lt;BR /&gt;Any help is appreciated.&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Mon, 02 Aug 2004 13:44:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347236#M191770</guid>
      <dc:creator>SAM_24</dc:creator>
      <dc:date>2004-08-02T13:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347237#M191771</link>
      <description>Check out the join command</description>
      <pubDate>Mon, 02 Aug 2004 13:48:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347237#M191771</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2004-08-02T13:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347238#M191772</link>
      <description>Here's one approach:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;INFILE="/mydir/myfile"&lt;BR /&gt;typeset -i10 I=0&lt;BR /&gt;cat ${INFILE} | while read X&lt;BR /&gt;  do&lt;BR /&gt;     if [[ $((${I} % 2)) -eq 0 ]]&lt;BR /&gt;       then&lt;BR /&gt;         echo "${X} \c"&lt;BR /&gt;        else&lt;BR /&gt;          echo "${X}"&lt;BR /&gt;        fi&lt;BR /&gt;      ((I + 1))&lt;BR /&gt;  done&lt;BR /&gt;if [[ $((${I} % 2)) -eq 1 ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Aug 2004 13:57:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347238#M191772</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-08-02T13:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347239#M191773</link>
      <description>Oops, I'm an idiot:&lt;BR /&gt;&lt;BR /&gt;((I + 1))&lt;BR /&gt;should be:&lt;BR /&gt;((I += 1))</description>
      <pubDate>Mon, 02 Aug 2004 14:38:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347239#M191773</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-08-02T14:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347240#M191774</link>
      <description>You can try the following:&lt;BR /&gt;awk '{printf("%s", $0)&lt;BR /&gt;if( NR%2 == 0)print "" }' filename&lt;BR /&gt;&lt;BR /&gt;HTH</description>
      <pubDate>Mon, 02 Aug 2004 14:50:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347240#M191774</guid>
      <dc:creator>Victor Fridyev</dc:creator>
      <dc:date>2004-08-02T14:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347241#M191775</link>
      <description>Use the "\c" in the print line:&lt;BR /&gt;&lt;BR /&gt;#print "LABEL1: ${output1} \c"&lt;BR /&gt;#print "LABEL2: ${output2}"&lt;BR /&gt;&lt;BR /&gt;This will print:&lt;BR /&gt;&lt;BR /&gt;LABEL1: some output LABEL2: some output&lt;BR /&gt;&lt;BR /&gt;If this isn't what you mean, we could use a little more info on what you are trying to do.</description>
      <pubDate>Mon, 02 Aug 2004 14:52:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347241#M191775</guid>
      <dc:creator>Jeff Carlin</dc:creator>
      <dc:date>2004-08-02T14:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347242#M191776</link>
      <description>Like Jeff I am not entirely sure what you are requesting. Please provide an attachement with slightly more complete input data and desired output date.&lt;BR /&gt;&lt;BR /&gt;If the data comes from 1 file, then join is not going to help much but maybe 'pr' can do it's trick.&lt;BR /&gt;&lt;BR /&gt;Check out: ps -2 -t -s seperate.txt &amp;gt; combined.txt&lt;BR /&gt;The -s changes column based to seperator character based output (default tab).&lt;BR /&gt;&lt;BR /&gt;Here is somehting in AWK actively looking for 'LABEL1:':&lt;BR /&gt;&lt;BR /&gt;awk '/^[A-Z0-9]+:/{if (i++%2) {print one, $0} else {one=$0}}' seperate.txt &amp;gt; combined.txt&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here the part between // actually looks specifically for a line, beginning with (^) a series of once or more (+) characters in the range of A thru Z or 0 - 9 ([...]) followed by a colon (:).&lt;BR /&gt;If you just want any old line (like the pr solution) then simplify to:&lt;BR /&gt;&lt;BR /&gt;awk '{if (i++%2) {print one, $0} else {one=$0}}' seperate.txt &amp;gt; combined.txt&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If the 'labels' are strictly and only a series of Uppercase characters, followed by a series of numbers at the start of a line then the // becomes: /^[A-Z]+[0-9]+:/&lt;BR /&gt;&lt;BR /&gt;Many more options possible, but you'll have to help us describe them if you can not figure it out yourself.&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Aug 2004 00:09:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347242#M191776</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-08-03T00:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347243#M191777</link>
      <description>Hi,&lt;BR /&gt;Is this what you are looking for!!&lt;BR /&gt;&lt;BR /&gt;# more file1&lt;BR /&gt;LABEL1:some output&lt;BR /&gt;LABEL2:some output&lt;BR /&gt;#&lt;BR /&gt;# cat file1 | xargs&lt;BR /&gt;LABEL1:some output LABEL2:some output&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;Regards,</description>
      <pubDate>Tue, 03 Aug 2004 01:11:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347243#M191777</guid>
      <dc:creator>Bharat Katkar</dc:creator>
      <dc:date>2004-08-03T01:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347244#M191778</link>
      <description>If you want to join two lines , then use as,&lt;BR /&gt;&lt;BR /&gt;set -x&lt;BR /&gt;# Execute with a filename&lt;BR /&gt;i=0&lt;BR /&gt;while read line; do&lt;BR /&gt;echo -n "$line "&lt;BR /&gt;let i=i+1&lt;BR /&gt;if [[ $((i%2)) -eq 0 ]]; then&lt;BR /&gt;  echo ""&lt;BR /&gt;fi&lt;BR /&gt;done &amp;lt; $1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-- muthu ---</description>
      <pubDate>Tue, 03 Aug 2004 01:19:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347244#M191778</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-08-03T01:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347245#M191779</link>
      <description>We can do it with sed and echo as,&lt;BR /&gt;&lt;BR /&gt;set -x&lt;BR /&gt;# Execute with file - $1 filename&lt;BR /&gt;&lt;BR /&gt;i=1&lt;BR /&gt;count=$(cat $1 | wc -l)&lt;BR /&gt;&lt;BR /&gt;while [[ $i -le $count ]]; do&lt;BR /&gt; &lt;BR /&gt; echo `sed -n $i,$(($i+1))p $1`&lt;BR /&gt; &lt;BR /&gt; let i=i+2&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;-- muthu --</description>
      <pubDate>Tue, 03 Aug 2004 01:43:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347245#M191779</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-08-03T01:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347246#M191780</link>
      <description>If u want to combine every two lines into a single line then this will help.&lt;BR /&gt;&lt;BR /&gt;awk '{line1=$0; getline; print line1 " " $0 }'  filename&lt;BR /&gt;&lt;BR /&gt;Else If u want to combine many lines into a single line then this will be useful&lt;BR /&gt;&lt;BR /&gt;cat filename | xargs&lt;BR /&gt;&lt;BR /&gt;-Saravanan</description>
      <pubDate>Wed, 04 Aug 2004 06:55:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3347246#M191780</guid>
      <dc:creator>Saravanan_11</dc:creator>
      <dc:date>2004-08-04T06:55:53Z</dc:date>
    </item>
  </channel>
</rss>

