<?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: script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864784#M277320</link>
    <description>Hi Rajim:&lt;BR /&gt;&lt;BR /&gt;# perl -nale 'push @a,join "-", @F;END{print join "-",@a}' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Mon, 18 Sep 2006 13:22:17 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2006-09-18T13:22:17Z</dc:date>
    <item>
      <title>script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864783#M277319</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I have the following lines as input:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;10:27:01     0       0       0       0     100&lt;BR /&gt;             1       0       1       0      99&lt;BR /&gt;             2       3       0       0      97&lt;BR /&gt;             3       6       1       0      92&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I want to format the ouput as:&lt;BR /&gt;&lt;BR /&gt;Ex: &lt;BR /&gt;10:27:01-0-1-2-3-0-0-3-6-0-1-0-1-0-0-0-0-100-99-97-92&lt;BR /&gt;     &lt;BR /&gt;&lt;BR /&gt;Thanks!!&lt;BR /&gt;Rajim</description>
      <pubDate>Mon, 18 Sep 2006 13:11:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864783#M277319</guid>
      <dc:creator>sheevm</dc:creator>
      <dc:date>2006-09-18T13:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864784#M277320</link>
      <description>Hi Rajim:&lt;BR /&gt;&lt;BR /&gt;# perl -nale 'push @a,join "-", @F;END{print join "-",@a}' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 18 Sep 2006 13:22:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864784#M277320</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-18T13:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864785#M277321</link>
      <description>Hi James,&lt;BR /&gt;&lt;BR /&gt;Thanks.  I just executed your command it kind of worked. but not exactly. Pardon me, I do not know perl.&lt;BR /&gt;&lt;BR /&gt;10:27:01 0 0 0 0 100&lt;BR /&gt;         1 0 1 0  99&lt;BR /&gt;         2 3 0 0  97&lt;BR /&gt;         3 6 1 0  92&lt;BR /&gt;&lt;BR /&gt;I want (2nd row through 4th row coulmn data)&lt;BR /&gt;&lt;BR /&gt;10:27:01-0-1-2-3-0-0-3-6-0-1-0-1-0-0-0-01-100-99-97-92&lt;BR /&gt;&lt;BR /&gt;Your command gives&lt;BR /&gt;&lt;BR /&gt;10:27:01-0-0-0-0-100-1-0-1-0-99-2-3-0-0-97-3-6-1-0-92&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Can you suggest me a good book on perl for dummies&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Sep 2006 13:55:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864785#M277321</guid>
      <dc:creator>sheevm</dc:creator>
      <dc:date>2006-09-18T13:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864786#M277322</link>
      <description>&lt;!--!*#--&gt;Try the awk script below...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;awk '{&lt;BR /&gt;  if(NR==1) {&lt;BR /&gt;    tmp=$1&lt;BR /&gt;    for (i=2;i&amp;lt;=NF;++i) {&lt;BR /&gt;       if (x[i])&lt;BR /&gt;          x[i]=x[i]"-"$i&lt;BR /&gt;       else&lt;BR /&gt;          x[i]=$i&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;  else&lt;BR /&gt;     for (i=1;i&amp;lt;=NF;++i)&lt;BR /&gt;        x[i+1]=x[i+1]"-"$i&lt;BR /&gt;}END{&lt;BR /&gt;  for (i=1;i&amp;lt;=NF+1;++i) {&lt;BR /&gt;     if (z)&lt;BR /&gt;        z=z"-"x[i]&lt;BR /&gt;     else&lt;BR /&gt;        z=tmp&lt;BR /&gt;  }&lt;BR /&gt;  print z&lt;BR /&gt;}' infile</description>
      <pubDate>Mon, 18 Sep 2006 15:51:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864786#M277322</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-09-18T15:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864787#M277323</link>
      <description>Rajim,&lt;BR /&gt;&lt;BR /&gt;That was a horrible problem specification.&lt;BR /&gt;&amp;gt;&amp;gt; I want (2nd row through 4th row coulmn data)&lt;BR /&gt;&lt;BR /&gt;Your data suggests you wnat 1st thru 5th unless there is a timestamp, in which case you want 2 - 6&lt;BR /&gt;&lt;BR /&gt;That appears to be a horrible output format.&lt;BR /&gt;What if you ever get an other line of data?&lt;BR /&gt;&lt;BR /&gt;Anyway, here is a chunk of perl with can read multiple blocks of your data pattern:&lt;BR /&gt;&lt;BR /&gt;---- input ---&lt;BR /&gt;10:27:01 0 0 0 0 100&lt;BR /&gt;1 0 1 0 99&lt;BR /&gt;2 3 0 0 97&lt;BR /&gt;3 6 1 0 92&lt;BR /&gt;10:27:23 0 a 0 0 80&lt;BR /&gt;1 b 1 0 81&lt;BR /&gt;2 c 0 0 82&lt;BR /&gt;3 d 1 0 83&lt;BR /&gt;&lt;BR /&gt;--------------- output --------&lt;BR /&gt;&lt;BR /&gt;10:27:01-0-1-2-3-0-0-3-6-0-1-0-1-0-0-0-0-100-99-97-92&lt;BR /&gt;10:27:23-0-1-2-3-a-b-c-d-0-1-0-1-0-0-0-0-80-81-82-83&lt;BR /&gt;&lt;BR /&gt;----------- perl ------&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;  @words = split;&lt;BR /&gt;  if (/^\d*:\d+:/) {&lt;BR /&gt;    &amp;amp;myprint;&lt;BR /&gt;    undef @data;&lt;BR /&gt;    $line = 0;&lt;BR /&gt;    $time = shift @words;&lt;BR /&gt;    }&lt;BR /&gt;  $col = 0;&lt;BR /&gt;  while (defined ($x = shift @words)) {&lt;BR /&gt;    $data[$line][$col++] = $x;&lt;BR /&gt;    }&lt;BR /&gt;  $line++;&lt;BR /&gt;  }&lt;BR /&gt;&amp;amp;myprint;&lt;BR /&gt;&lt;BR /&gt;sub myprint {&lt;BR /&gt;  if ($time) {&lt;BR /&gt;    print "$time";&lt;BR /&gt;    for $c (0..4) {&lt;BR /&gt;      for $l (0..$line-1) {&lt;BR /&gt;        print '-',$data[$l][$c];&lt;BR /&gt;      }&lt;BR /&gt;    }&lt;BR /&gt;  print "\n";&lt;BR /&gt;  }&lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Sep 2006 22:31:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864787#M277323</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-09-18T22:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864788#M277324</link>
      <description>&lt;!--!*#--&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;this seems to me a simple awk solution:&lt;BR /&gt;&lt;BR /&gt;awk -v col=5 'function out () {&lt;BR /&gt;printf dtm;for (j=1;j&lt;I&gt;NF == (col+1) {if(found) out();dtm=$1; for (i=2;i&amp;lt;=NF;i++) a[i-1]=$i;found++}&lt;BR /&gt;NF == col {for (i=1;i&amp;lt;=NF;i++) a[i]=a[i]"-"$i}&lt;BR /&gt;END {if(found) out()}'  output-file&lt;BR /&gt;&lt;BR /&gt;For customization, set&lt;BR /&gt;awk -v col=5 ...&lt;BR /&gt;to the appropriate value. Multiple blocks (starting with an additional date field) are processed and reported.&lt;BR /&gt;Lines not containing col or (col+1) columns are ignored.&lt;BR /&gt;&lt;BR /&gt;mfG Peter&lt;/I&gt;</description>
      <pubDate>Tue, 19 Sep 2006 10:34:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864788#M277324</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-09-19T10:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864789#M277325</link>
      <description>Thanks for all of your responses.&lt;BR /&gt;&lt;BR /&gt;I will be submitting points soon.</description>
      <pubDate>Wed, 20 Sep 2006 11:11:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3864789#M277325</guid>
      <dc:creator>sheevm</dc:creator>
      <dc:date>2006-09-20T11:11:32Z</dc:date>
    </item>
  </channel>
</rss>

