<?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: Random sampling from a file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499052#M830737</link>
    <description>Perfect! Thanks much!  &lt;BR /&gt;Cathy</description>
    <pubDate>Wed, 28 Feb 2001 00:03:25 GMT</pubDate>
    <dc:creator>cbres00</dc:creator>
    <dc:date>2001-02-28T00:03:25Z</dc:date>
    <item>
      <title>Random sampling from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499045#M830730</link>
      <description>I have a file over 650,000 lines long.  I need to send a random sampling of these lines to someone for verification. How can I do this?  Thanks in advance.</description>
      <pubDate>Tue, 27 Feb 2001 23:01:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499045#M830730</guid>
      <dc:creator>cbres00</dc:creator>
      <dc:date>2001-02-27T23:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Random sampling from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499046#M830731</link>
      <description>Korn shell has a $RANDOM variable inbuilt. You can use it here . Its value is between 0 and 32767 i guess. Since you file has 650000 lines , you can directly use this number or do soem arithmatic with it. You can then use this number to do some operation on the file like tail or head etc.&lt;BR /&gt;&lt;BR /&gt;hope this helps.</description>
      <pubDate>Tue, 27 Feb 2001 23:27:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499046#M830731</guid>
      <dc:creator>Jitendra_1</dc:creator>
      <dc:date>2001-02-27T23:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Random sampling from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499047#M830732</link>
      <description>Excellent!  I'm pretty new&lt;BR /&gt;to this scripting thing, so may I indulge your patience?&lt;BR /&gt;How would I code the head&lt;BR /&gt;statement?  Thanks...</description>
      <pubDate>Tue, 27 Feb 2001 23:31:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499047#M830732</guid>
      <dc:creator>cbres00</dc:creator>
      <dc:date>2001-02-27T23:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Random sampling from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499048#M830733</link>
      <description>Ok , here it goes:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;file="/path/filename"   # Your data file &lt;BR /&gt;Number=`echo "($RANDOM)" |bc`  # This is first random number&lt;BR /&gt;OtherNumber=`echo "($RANDOM)" |bc` # This is second random number&lt;BR /&gt;&lt;BR /&gt;#Now test which number is bigger&lt;BR /&gt;&lt;BR /&gt;if [ $Number -gt $Othernumber ];&lt;BR /&gt;then &lt;BR /&gt;   cat $filename | tail $Number | Head $othername &lt;BR /&gt;else&lt;BR /&gt;   cat $filename | tail $othername |head $Number&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So for example ( say your data file has 500 lines altogether) if the first number is 400 and second is 300 , the program will show you the lines starting from 100 to 400 . &lt;BR /&gt;&lt;BR /&gt;Hope this is clear.&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Feb 2001 23:47:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499048#M830733</guid>
      <dc:creator>Jitendra_1</dc:creator>
      <dc:date>2001-02-27T23:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Random sampling from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499049#M830734</link>
      <description>sorry , read that $othername as $Othernumber .&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 27 Feb 2001 23:49:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499049#M830734</guid>
      <dc:creator>Jitendra_1</dc:creator>
      <dc:date>2001-02-27T23:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Random sampling from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499050#M830735</link>
      <description>So it'll always grab some part of the beginning or the end of the file? I was hoping to grab some data from the middle, also.  T.I.A...</description>
      <pubDate>Tue, 27 Feb 2001 23:56:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499050#M830735</guid>
      <dc:creator>cbres00</dc:creator>
      <dc:date>2001-02-27T23:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Random sampling from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499051#M830736</link>
      <description>No , in fact this script also will grab the middle part only. The tail -$Number | head -$Othernumber is exactly for this purpose.&lt;BR /&gt;&lt;BR /&gt;For another example say this is your file:&lt;BR /&gt;test line1&lt;BR /&gt;test line2&lt;BR /&gt;test line3&lt;BR /&gt;test line4&lt;BR /&gt;test line5&lt;BR /&gt;&lt;BR /&gt;Then it will grab something like this :&lt;BR /&gt;&lt;BR /&gt;test line2&lt;BR /&gt;test line3&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;etc.etc.&lt;BR /&gt;&lt;BR /&gt;Hope this helps</description>
      <pubDate>Wed, 28 Feb 2001 00:00:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499051#M830736</guid>
      <dc:creator>Jitendra_1</dc:creator>
      <dc:date>2001-02-28T00:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Random sampling from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499052#M830737</link>
      <description>Perfect! Thanks much!  &lt;BR /&gt;Cathy</description>
      <pubDate>Wed, 28 Feb 2001 00:03:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499052#M830737</guid>
      <dc:creator>cbres00</dc:creator>
      <dc:date>2001-02-28T00:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Random sampling from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499053#M830738</link>
      <description>I think there needs to be a&lt;BR /&gt;minus in front of the $Number and $Othernumber in the head/tail references.  Otherwise it treats it as a filename.  &lt;BR /&gt;&lt;BR /&gt;I think.  ;-)</description>
      <pubDate>Wed, 28 Feb 2001 00:27:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499053#M830738</guid>
      <dc:creator>cbres00</dc:creator>
      <dc:date>2001-02-28T00:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Random sampling from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499054#M830739</link>
      <description>You are right , there has to be minus sign there. Sorry for my typing .</description>
      <pubDate>Wed, 28 Feb 2001 01:03:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-sampling-from-a-file/m-p/2499054#M830739</guid>
      <dc:creator>Jitendra_1</dc:creator>
      <dc:date>2001-02-28T01:03:46Z</dc:date>
    </item>
  </channel>
</rss>

