<?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 Need perl script for this test data in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-perl-script-for-this-test-data/m-p/4226093#M687241</link>
    <description>sample 2 records: I have  million records like this&lt;BR /&gt;&lt;BR /&gt;test data:&lt;BR /&gt;&lt;BR /&gt;Name Measure1 Measure2 Measure3 Measure4&lt;BR /&gt;aaa  67                 345       987&lt;BR /&gt;bbb  678      445       567       123&lt;BR /&gt;&lt;BR /&gt;delimter ( ,)&lt;BR /&gt;&lt;BR /&gt;I need to have perl script which reads input file from the user&lt;BR /&gt;&lt;BR /&gt;Am intersted to do validation for Measure2 and Measure4 only &lt;BR /&gt;&lt;BR /&gt;i need to pass one input file saying Pick Measure2 and Measure4 &lt;BR /&gt;and do the validation for Measure2 Checking for Non zero values, if any row contains Non zero it needs to redirect to one file saying particular Name is having Measure value non zero.&lt;BR /&gt;&lt;BR /&gt;one more validation if Measure4 contains the value greater than 500 then it also redirect to another file saying particular Name is having Measure value greater than 500 .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;Measure2.txt file should show &lt;BR /&gt;&lt;BR /&gt;Name  Measure2&lt;BR /&gt;aaa  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Measure4.txt file should show&lt;BR /&gt;&lt;BR /&gt;Name Measure4&lt;BR /&gt;aaa   987</description>
    <pubDate>Wed, 02 Jul 2008 01:27:11 GMT</pubDate>
    <dc:creator>kumar143</dc:creator>
    <dc:date>2008-07-02T01:27:11Z</dc:date>
    <item>
      <title>Need perl script for this test data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-perl-script-for-this-test-data/m-p/4226093#M687241</link>
      <description>sample 2 records: I have  million records like this&lt;BR /&gt;&lt;BR /&gt;test data:&lt;BR /&gt;&lt;BR /&gt;Name Measure1 Measure2 Measure3 Measure4&lt;BR /&gt;aaa  67                 345       987&lt;BR /&gt;bbb  678      445       567       123&lt;BR /&gt;&lt;BR /&gt;delimter ( ,)&lt;BR /&gt;&lt;BR /&gt;I need to have perl script which reads input file from the user&lt;BR /&gt;&lt;BR /&gt;Am intersted to do validation for Measure2 and Measure4 only &lt;BR /&gt;&lt;BR /&gt;i need to pass one input file saying Pick Measure2 and Measure4 &lt;BR /&gt;and do the validation for Measure2 Checking for Non zero values, if any row contains Non zero it needs to redirect to one file saying particular Name is having Measure value non zero.&lt;BR /&gt;&lt;BR /&gt;one more validation if Measure4 contains the value greater than 500 then it also redirect to another file saying particular Name is having Measure value greater than 500 .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;Measure2.txt file should show &lt;BR /&gt;&lt;BR /&gt;Name  Measure2&lt;BR /&gt;aaa  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Measure4.txt file should show&lt;BR /&gt;&lt;BR /&gt;Name Measure4&lt;BR /&gt;aaa   987</description>
      <pubDate>Wed, 02 Jul 2008 01:27:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-perl-script-for-this-test-data/m-p/4226093#M687241</guid>
      <dc:creator>kumar143</dc:creator>
      <dc:date>2008-07-02T01:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Need perl script for this test data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-perl-script-for-this-test-data/m-p/4226094#M687242</link>
      <description>You say the delimiter is a comma but the example has a space.  My script assumes space.&lt;BR /&gt;Also, I assume that the title isn't in the file?&lt;BR /&gt;(And the aaa line is missing a measure.)&lt;BR /&gt;I'm not sure why "bbb" isn't in your Measure2.txt file?&lt;BR /&gt;&lt;BR /&gt;You can use two awk scripts to extract the data, if you don't care about two passes:&lt;BR /&gt;awk '&lt;BR /&gt;$2 &amp;gt; 0 {print $1}&lt;BR /&gt;' input-file &amp;gt; Measure2.txt&lt;BR /&gt;And the other:&lt;BR /&gt;awk '&lt;BR /&gt;$5 &amp;gt; 500 {print $1, $5}&lt;BR /&gt;' input-file &amp;gt; Measure4.txt</description>
      <pubDate>Wed, 02 Jul 2008 02:55:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-perl-script-for-this-test-data/m-p/4226094#M687242</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-07-02T02:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need perl script for this test data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-perl-script-for-this-test-data/m-p/4226095#M687243</link>
      <description>As Dennis wonders... where are the 'commas'?&lt;BR /&gt;Could this be the forum software eating tabs and spaces?&lt;BR /&gt;Could the missing but supposed 0 for the aaa line be expunged due to the presentation?&lt;BR /&gt;&lt;BR /&gt;PLEASE ATTACH actual sample niput as a .TXT file next time?&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;$ awk  '!$2 {print $1 &amp;gt; "measure2.tmp"} $4&amp;gt;500 { print $1,$4 &amp;gt; "measure4.tmp" } ' x&lt;BR /&gt;&lt;BR /&gt;$ cat measure2.tmp&lt;BR /&gt;a3a&lt;BR /&gt;a7a&lt;BR /&gt;&lt;BR /&gt;$ cat measure4.tmp&lt;BR /&gt;b2b 567&lt;BR /&gt;b6b 567&lt;BR /&gt;&lt;BR /&gt;$ cat x&lt;BR /&gt;a1a 1 67 345 987&lt;BR /&gt;b2b 678 445 567 123&lt;BR /&gt;a3a 0 67 345 87&lt;BR /&gt;b4b 678 445 67 123&lt;BR /&gt;a5a 1 67 345 987&lt;BR /&gt;b6b 678 445 567 123&lt;BR /&gt;a7a 0 67 345 87&lt;BR /&gt;b8b 678 445 67 123&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;ps... In perl...&lt;BR /&gt;&lt;BR /&gt;$ perl -e 'open M2,"&amp;gt;m2.tmp"; open M4,"&amp;gt;m4.tmp"; while (&amp;lt;&amp;gt;) {@F=split; if (!@F[1]){print M2 "@F[0]\n"}; if (@F[3]&amp;gt;500){print M4 "@F[0] @F[3]\n"}}' x  &lt;BR /&gt;&lt;BR /&gt;$ cat m4.tmp&lt;BR /&gt;b2b 567&lt;BR /&gt;b6b 567&lt;BR /&gt;$ cat m2.tmp&lt;BR /&gt;a3a&lt;BR /&gt;a7a&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Jul 2008 03:46:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-perl-script-for-this-test-data/m-p/4226095#M687243</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-07-02T03:46:14Z</dc:date>
    </item>
  </channel>
</rss>

