<?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: data processing script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179731#M794785</link>
    <description>SMOP.&lt;BR /&gt;&lt;BR /&gt;If all you need is those ranges of 100 that can be mathematically calculated, if file b idoes not have arbretrary ranges, then you can use an awk one-liner like:&lt;BR /&gt;&lt;BR /&gt;awk -F, '{print $1,$2,100*int(($3+99)/100)}' &amp;lt; a&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you need the rnages in a file, you'd have to think about what to do if a value is not in a known range. In the example below I ignored that by just using the high values and adding a 'very high' in the script.&lt;BR /&gt;&lt;BR /&gt;The script begins by reading b remembering high values in an array with m elements. I then set the field seperator to comma for convenient field splittnig.&lt;BR /&gt;Then for each main file line reade (a) it compares the last field (#3) with entries in the array, starting at zero, ending one too far. Adjust and print.&lt;BR /&gt;&lt;BR /&gt;BEGIN { while (getline &amp;lt; "b") {&lt;BR /&gt;        high[m++]=$2;&lt;BR /&gt;        }&lt;BR /&gt;        high[m]=999999;&lt;BR /&gt;        FS=",";&lt;BR /&gt;        }&lt;BR /&gt;{ i=0;&lt;BR /&gt;  while ($3 &amp;gt; high[i++]);&lt;BR /&gt;  i--;&lt;BR /&gt;  print $1, $2, high[i];&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
    <pubDate>Sun, 01 Feb 2004 11:04:53 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2004-02-01T11:04:53Z</dc:date>
    <item>
      <title>data processing script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179729#M794783</link>
      <description>I have a filename a whose data looks like below&lt;BR /&gt;2004-01-29 01:27:09,999171234567,303 &lt;BR /&gt;2004-01-29 01:27:09,119171234567,562 &lt;BR /&gt;I have filenameb whose data looks like below&lt;BR /&gt;101 200&lt;BR /&gt;201 300&lt;BR /&gt;301 400&lt;BR /&gt;401 500&lt;BR /&gt;501 600&lt;BR /&gt;I need to run a script which changes the last column value of filenamea to a value from filenameb which is within that range (higher value) ex. 303 between 301 &amp;amp; 400 so I change 303 to 400, next is 562 between 501 &amp;amp; 600 so I change it to 600. Is awk possible here.&lt;BR /&gt;Output from filenamea would then be.....&lt;BR /&gt;2004-01-29 01:27:09,999171234567,300 &lt;BR /&gt;2004-01-29 01:27:09,119171234567,600&lt;BR /&gt;Pls note that last column values where changed based on the filenameb.&lt;BR /&gt;Hope you can help me out here. I've done simple programs but this one can't do it. &lt;BR /&gt;Thanks.&lt;BR /&gt;Ferdie&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 01 Feb 2004 08:47:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179729#M794783</guid>
      <dc:creator>Ferdie Castro</dc:creator>
      <dc:date>2004-02-01T08:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: data processing script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179730#M794784</link>
      <description>If you are willing to do some hunting, thats been done on this forum:&lt;BR /&gt;&lt;BR /&gt;search awk scripts or:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=51050" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=51050&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x836cc1c4ceddd61190050090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x836cc1c4ceddd61190050090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x026250011d20d6118ff40090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x026250011d20d6118ff40090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I don't have the patience to write it for you right now,sorry.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Sun, 01 Feb 2004 09:18:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179730#M794784</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-02-01T09:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: data processing script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179731#M794785</link>
      <description>SMOP.&lt;BR /&gt;&lt;BR /&gt;If all you need is those ranges of 100 that can be mathematically calculated, if file b idoes not have arbretrary ranges, then you can use an awk one-liner like:&lt;BR /&gt;&lt;BR /&gt;awk -F, '{print $1,$2,100*int(($3+99)/100)}' &amp;lt; a&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you need the rnages in a file, you'd have to think about what to do if a value is not in a known range. In the example below I ignored that by just using the high values and adding a 'very high' in the script.&lt;BR /&gt;&lt;BR /&gt;The script begins by reading b remembering high values in an array with m elements. I then set the field seperator to comma for convenient field splittnig.&lt;BR /&gt;Then for each main file line reade (a) it compares the last field (#3) with entries in the array, starting at zero, ending one too far. Adjust and print.&lt;BR /&gt;&lt;BR /&gt;BEGIN { while (getline &amp;lt; "b") {&lt;BR /&gt;        high[m++]=$2;&lt;BR /&gt;        }&lt;BR /&gt;        high[m]=999999;&lt;BR /&gt;        FS=",";&lt;BR /&gt;        }&lt;BR /&gt;{ i=0;&lt;BR /&gt;  while ($3 &amp;gt; high[i++]);&lt;BR /&gt;  i--;&lt;BR /&gt;  print $1, $2, high[i];&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Sun, 01 Feb 2004 11:04:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179731#M794785</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-02-01T11:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: data processing script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179732#M794786</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;use awk -f t.awk filenamea&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Feb 2004 05:11:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179732#M794786</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-02-02T05:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: data processing script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179733#M794787</link>
      <description>fwiw/nitpicking...&lt;BR /&gt;&lt;BR /&gt;Before you put Michael's solution into production you should add a 'VAL="?????";'&lt;BR /&gt;in the begin of the main loop (near FS=",";)&lt;BR /&gt;&lt;BR /&gt;This will make sure that if, somehow, a value is outside an established range it will print something odd instead of repeat the last-used range.&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Feb 2004 00:52:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179733#M794787</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-02-03T00:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: data processing script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179734#M794788</link>
      <description>I've done this in the past... What you could do is concat both files with a good marker.&lt;BR /&gt;&lt;BR /&gt;You could do it like this:&lt;BR /&gt;&lt;BR /&gt;( cat filenameb ; echo "---split---" ; cat filenamea ) | awk ' BEGIN { gotsplit=0; idx=0}&lt;BR /&gt;/---split---/ { gotsplit=1; FS=","; next }&lt;BR /&gt;gotsplit==0 { minval[idx]=$1;maxval[idx]=$2;idx++}&lt;BR /&gt;gotsplit==1 { found=-1;i=0;while ( i &amp;lt; idx) { if ($NF &amp;gt;= minval[i] &amp;amp;&amp;amp; $NF &amp;lt;= maxval[i]) { found=i } i++ } if (found!=-1) { $NF=maxval[found] } print }&lt;BR /&gt;'</description>
      <pubDate>Tue, 03 Feb 2004 02:09:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-processing-script/m-p/3179734#M794788</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-02-03T02:09:16Z</dc:date>
    </item>
  </channel>
</rss>

