<?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: Comparing columns in a file help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412655#M682162</link>
    <description>None of the data you show meets your criteria of "column 2's value is greater than column 1's value by double or more".  &lt;BR /&gt;&lt;BR /&gt;Or, are you wanting all lines where column 2 is simply greater than column 1?&lt;BR /&gt;&lt;BR /&gt;Your data, and your description, do not go together, at all.&lt;BR /&gt;&lt;BR /&gt;Now, presuming that your description is what you want, the following awk command should work for you:&lt;BR /&gt;&lt;BR /&gt;awk '{a=$1*2;if(a&amp;gt;=$2){print $0}}' &amp;lt; input_file&lt;BR /&gt;&lt;BR /&gt;This will display back to stdout all lines where the value in column 2 is twice or more the value in column 1.</description>
    <pubDate>Mon, 04 May 2009 15:47:35 GMT</pubDate>
    <dc:creator>Michael Mike Reaser</dc:creator>
    <dc:date>2009-05-04T15:47:35Z</dc:date>
    <item>
      <title>Comparing columns in a file help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412654#M682161</link>
      <description>I have a file that contains 2 columns.  &lt;BR /&gt;&lt;BR /&gt;file1:&lt;BR /&gt;10.994  14.514&lt;BR /&gt;13.506  16.587&lt;BR /&gt;16.156  15.597&lt;BR /&gt;14.008  13.609&lt;BR /&gt;12.617  14.532&lt;BR /&gt;&lt;BR /&gt;I need to compare the 2 columns and determine that if column 2's value is greater than column 1's value by double or more I want to know about it.  basically just print the row that meets that above standards.  Any ideas?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 04 May 2009 15:20:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412654#M682161</guid>
      <dc:creator>Michael Barron</dc:creator>
      <dc:date>2009-05-04T15:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing columns in a file help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412655#M682162</link>
      <description>None of the data you show meets your criteria of "column 2's value is greater than column 1's value by double or more".  &lt;BR /&gt;&lt;BR /&gt;Or, are you wanting all lines where column 2 is simply greater than column 1?&lt;BR /&gt;&lt;BR /&gt;Your data, and your description, do not go together, at all.&lt;BR /&gt;&lt;BR /&gt;Now, presuming that your description is what you want, the following awk command should work for you:&lt;BR /&gt;&lt;BR /&gt;awk '{a=$1*2;if(a&amp;gt;=$2){print $0}}' &amp;lt; input_file&lt;BR /&gt;&lt;BR /&gt;This will display back to stdout all lines where the value in column 2 is twice or more the value in column 1.</description>
      <pubDate>Mon, 04 May 2009 15:47:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412655#M682162</guid>
      <dc:creator>Michael Mike Reaser</dc:creator>
      <dc:date>2009-05-04T15:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing columns in a file help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412656#M682163</link>
      <description>Mike,&lt;BR /&gt;&lt;BR /&gt;  Thanks, the file was just an example, there are hundreds and hundreds of lines in the file and happen to grab some that dont work.  Thanks again for the idea.  I'll test it out and see if its what I need, i appreciate your help&lt;BR /&gt;</description>
      <pubDate>Mon, 04 May 2009 15:51:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412656#M682163</guid>
      <dc:creator>Michael Barron</dc:creator>
      <dc:date>2009-05-04T15:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing columns in a file help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412657#M682164</link>
      <description>Th awk statement works, but I get mixed results.  &lt;BR /&gt;1.242   4.363  (Works here)&lt;BR /&gt;1.268   8.955  (Works here)&lt;BR /&gt;1.346   0.888  (Not here)&lt;BR /&gt;1.195   0.992  (Not here)&lt;BR /&gt;&lt;BR /&gt;Thanks again for your help&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 04 May 2009 16:05:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412657#M682164</guid>
      <dc:creator>Michael Barron</dc:creator>
      <dc:date>2009-05-04T16:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing columns in a file help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412658#M682165</link>
      <description>That's because the conditional I listed is backwards.  The correct awk command should be&lt;BR /&gt;&lt;BR /&gt;awk '{a=$1*2;if(a&amp;lt;=$2){print $0}}' &amp;lt; input_file&lt;BR /&gt;&lt;BR /&gt;Whoops, and sorry.  :-)</description>
      <pubDate>Mon, 04 May 2009 16:29:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412658#M682165</guid>
      <dc:creator>Michael Mike Reaser</dc:creator>
      <dc:date>2009-05-04T16:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing columns in a file help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412659#M682166</link>
      <description>Awesome, works perfect, thanks again!</description>
      <pubDate>Mon, 04 May 2009 16:33:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412659#M682166</guid>
      <dc:creator>Michael Barron</dc:creator>
      <dc:date>2009-05-04T16:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing columns in a file help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412660#M682167</link>
      <description>&lt;!--!*#--&gt;here is another solution with a while loop in ksh:&lt;BR /&gt;&lt;BR /&gt;# while read col1 col2; do if [ $(echo $col1*2000 | bc ) -lt $(echo $col2*1000 | bc ) ];then echo $col1 $col2;fi;done &amp;lt; inputfile</description>
      <pubDate>Tue, 05 May 2009 09:04:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-columns-in-a-file-help/m-p/4412660#M682167</guid>
      <dc:creator>Viktor Balogh</dc:creator>
      <dc:date>2009-05-05T09:04:01Z</dc:date>
    </item>
  </channel>
</rss>

