<?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: reading specific line no. in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919196#M32637</link>
    <description>Thank you for your reply John,&lt;BR /&gt;I will keep the use of search in mind. I believe search normally does work in V7.3-2 (the way you have shown) unless there is something specifically different in V8.2  (from earlier versions of search )that you are trying to show here.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 25 Aug 2005 15:57:26 GMT</pubDate>
    <dc:creator>nipun_2</dc:creator>
    <dc:date>2005-08-25T15:57:26Z</dc:date>
    <item>
      <title>reading specific line no.</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919188#M32629</link>
      <description>Hi,&lt;BR /&gt;I have been posting too many queries lately as I am in crunch time!!!. &lt;BR /&gt;Thanks a bunch for helping out. &lt;BR /&gt;&lt;BR /&gt;Even though I have not responded to few of them I have read and applied them and it has worked wonders!!!&lt;BR /&gt;&lt;BR /&gt;I am trying to read specific line nos from a personal log file and make a new "results.txt" file.&lt;BR /&gt;&lt;BR /&gt;However, I am not able to do so and I am not able to figure out the reason. &lt;BR /&gt;&lt;BR /&gt;IPLXXX - perosonal log file&lt;BR /&gt;LINE_NO.TXT - Contains the line nos(one in each line e.g &lt;BR /&gt;23&lt;BR /&gt;34 &lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;45&lt;BR /&gt;[end]&lt;BR /&gt;I wish to read from personal log file )&lt;BR /&gt;Results.txt - Should contain the specified lines copied from IPLXXX.log &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here is the script&lt;BR /&gt;$ open read_con IPL_ALL_RESULTS_TRAB.LOG&lt;BR /&gt;$ open read_line LINE_NO.TXT &lt;BR /&gt;$ open/write output []results.txt&lt;BR /&gt;$ count =0;&lt;BR /&gt;$ LOOP1:&lt;BR /&gt;$ read /end_of_file=END read_con linex&lt;BR /&gt;$ count = count+1&lt;BR /&gt;$! read /end_of_file=END read_line line &lt;BR /&gt;$ if count .eq. line then write output linex&lt;BR /&gt;$ GOTO LOOP1&lt;BR /&gt;$ END:&lt;BR /&gt;$ close read_con&lt;BR /&gt;$ close output&lt;BR /&gt;$ close read_line&lt;BR /&gt;$ exit &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Aug 2005 08:16:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919188#M32629</guid>
      <dc:creator>nipun_2</dc:creator>
      <dc:date>2005-08-18T08:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: reading specific line no.</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919189#M32630</link>
      <description>Here is the new script&lt;BR /&gt;$ open read_con IPL_ALL_RESULTS_TRAB.LOG&lt;BR /&gt;$ open read_line LINE_NO.TXT &lt;BR /&gt;$ open/write output []results.txt&lt;BR /&gt;$ count =0;&lt;BR /&gt;$ LOOP1:&lt;BR /&gt;$ read /end_of_file=END read_con linex&lt;BR /&gt;$ count = count+1&lt;BR /&gt;$! read /end_of_file=END read_line line &lt;BR /&gt;$! =====================================&lt;BR /&gt;$! I suppose line is read from file&lt;BR /&gt;$! so it's string variable&lt;BR /&gt;$! In your example is not defined&lt;BR /&gt;$! =====================================&lt;BR /&gt;$ if count .eq. f$int(line) -&lt;BR /&gt; then write output linex&lt;BR /&gt;$ GOTO LOOP1&lt;BR /&gt;$ END:&lt;BR /&gt;$ close read_con&lt;BR /&gt;$ close output&lt;BR /&gt;$ close read_line&lt;BR /&gt;$ exit &lt;BR /&gt; &lt;BR /&gt;Antonio Vigliotti&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Aug 2005 08:25:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919189#M32630</guid>
      <dc:creator>Antoniov.</dc:creator>
      <dc:date>2005-08-18T08:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: reading specific line no.</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919190#M32631</link>
      <description>Try the following...&lt;BR /&gt;&lt;BR /&gt;$ set noon&lt;BR /&gt;$ closee/nolog numbers&lt;BR /&gt;$ closee/nolog textfile&lt;BR /&gt;$ closee/nolog results&lt;BR /&gt;$ openn/read/error=bail_out numbers line_no.txt&lt;BR /&gt;$ openn/read/error=bail_out textfile ipl_all_results_trab.log&lt;BR /&gt;$ copyy/nolog NLA0: results.txt&lt;BR /&gt;$ openn/append/error=bail_out results results.txt&lt;BR /&gt;$ tcount = 0&lt;BR /&gt;$nloop:&lt;BR /&gt;$   readd/end_of_file=end_nloop/error=end_nloop numbers counter&lt;BR /&gt;$tloop:&lt;BR /&gt;$     readd/end_of_file=end_tloop/error=end_tloop textfile textline&lt;BR /&gt;$     tcount = tcount + 1&lt;BR /&gt;$     if (tcount .ne. counter) then goto tloop&lt;BR /&gt;$     if (tcount .eq. counter) then writee/error=bail_out results textline&lt;BR /&gt;$end_tloop:&lt;BR /&gt;$  goto nloop&lt;BR /&gt;$end_nloop:&lt;BR /&gt;$ closee/nolog results&lt;BR /&gt;$ closee/nolog textfile&lt;BR /&gt;$ closee/nolog numbers&lt;BR /&gt;$ exitt 1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Dave&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Aug 2005 08:40:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919190#M32631</guid>
      <dc:creator>David B Sneddon</dc:creator>
      <dc:date>2005-08-18T08:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: reading specific line no.</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919191#M32632</link>
      <description>Of course the line&lt;BR /&gt;&lt;BR /&gt;$bail_out:&lt;BR /&gt;&lt;BR /&gt;should appear just before the $ exitt 1&lt;BR /&gt;&lt;BR /&gt;Dave&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Aug 2005 08:43:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919191#M32632</guid>
      <dc:creator>David B Sneddon</dc:creator>
      <dc:date>2005-08-18T08:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: reading specific line no.</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919192#M32633</link>
      <description>&lt;BR /&gt;I'd use perl for this:&lt;BR /&gt;&lt;BR /&gt;$ cre t.tmp&lt;BR /&gt;aap&lt;BR /&gt;noot&lt;BR /&gt;mies&lt;BR /&gt;teun&lt;BR /&gt;vuur&lt;BR /&gt;$ cre l.tmp&lt;BR /&gt;3&lt;BR /&gt;5&lt;BR /&gt;$  perl -e "open L,shift @ARGV;while (&lt;L&gt;){chop;$l{$_}=1} while (&amp;lt;&amp;gt;) {print if $l{$.}}" l.tmp &amp;lt; t.tmp &amp;gt; r.tmp&lt;BR /&gt;$ type r.tmp&lt;BR /&gt;mies&lt;BR /&gt;vuur&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;This first reads the line number file and set an associative array element to 1 for each number found.&lt;BR /&gt;Next it loops through the rest of the input and prints if the array element for the current line number ($.) is true.&lt;BR /&gt;Done.&lt;BR /&gt;The line numbers need not be sorted.&lt;BR /&gt;&lt;BR /&gt;If they are sorted and you must use DCL then check this out:&lt;BR /&gt;&lt;BR /&gt;$ closee/nolog numbers&lt;BR /&gt;$ closee/nolog textfile&lt;BR /&gt;$ closee/nolog results&lt;BR /&gt;$ create r.tmp&lt;BR /&gt;$ open numbers l.tmp&lt;BR /&gt;$ open textfile t.tmp&lt;BR /&gt;$ open/append results r.tmp&lt;BR /&gt;$ tcount = 0&lt;BR /&gt;$&lt;BR /&gt;$number_loop:&lt;BR /&gt;$ readd/end=done numbers counter&lt;BR /&gt;$loop:&lt;BR /&gt;$ readd/end=done textfile textline&lt;BR /&gt;$ tcount = tcount + 1&lt;BR /&gt;$ if (tcount .lt. counter) then goto loop&lt;BR /&gt;$ write results textline&lt;BR /&gt;$ goto number_loop&lt;BR /&gt;$&lt;BR /&gt;$done:&lt;BR /&gt;$ closee/nolog results&lt;BR /&gt;$ closee/nolog textfile&lt;BR /&gt;$ closee/nolog numbers&lt;BR /&gt;$ exitt 1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;/L&gt;</description>
      <pubDate>Thu, 18 Aug 2005 09:39:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919192#M32633</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2005-08-18T09:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: reading specific line no.</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919193#M32634</link>
      <description>&lt;BR /&gt;btw... not exactly what you want, but it 'looks' close and is cute (in my sick mind):&lt;BR /&gt;&lt;BR /&gt;$ editt/edt/com=l.tmp t.tmp&lt;BR /&gt;    3       mies&lt;BR /&gt;    5       vuur&lt;BR /&gt;    5       vuur&lt;BR /&gt;*&lt;BR /&gt;&lt;BR /&gt;sorry, couldn't resist.&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Aug 2005 09:42:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919193#M32634</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2005-08-18T09:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: reading specific line no.</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919194#M32635</link>
      <description>Thanks for the reply. Basically doing what Antoniov mentioned did the trick. However, now I have a different problem with the script. But I will post it as a new thread&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Aug 2005 14:31:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919194#M32635</guid>
      <dc:creator>nipun_2</dc:creator>
      <dc:date>2005-08-18T14:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: reading specific line no.</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919195#M32636</link>
      <description>With V8.2 or higher, you can use the SEARCH command to select a specific line from a file. For example:&lt;BR /&gt;&lt;BR /&gt;$ SEARCH file ""/SKIP=22/LIMIT=1&lt;BR /&gt;&lt;BR /&gt;will display line 23&lt;BR /&gt;&lt;BR /&gt;A fairly expensive method to do what you want is therefore:&lt;BR /&gt;&lt;BR /&gt;$ OPEN/WRITE log IPLXXX.LOG&lt;BR /&gt;&lt;BR /&gt;then use&lt;BR /&gt;&lt;BR /&gt;$ SEARCH file ""/SKIP=line-1/LIMIT=1/OUT=log&lt;BR /&gt;&lt;BR /&gt;Probably not a really practical way to do what you want, but worth pointing out some of the less obvious uses for the new features of SEARCH</description>
      <pubDate>Thu, 18 Aug 2005 23:59:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919195#M32636</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2005-08-18T23:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: reading specific line no.</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919196#M32637</link>
      <description>Thank you for your reply John,&lt;BR /&gt;I will keep the use of search in mind. I believe search normally does work in V7.3-2 (the way you have shown) unless there is something specifically different in V8.2  (from earlier versions of search )that you are trying to show here.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Aug 2005 15:57:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/reading-specific-line-no/m-p/4919196#M32637</guid>
      <dc:creator>nipun_2</dc:creator>
      <dc:date>2005-08-25T15:57:26Z</dc:date>
    </item>
  </channel>
</rss>

