<?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: Long text file truncate in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116447#M39012</link>
    <description>Another option if the freeware EXTRACT program.&lt;BR /&gt;&lt;A href="http://vms.process.com/scripts/fileserv/fileserv.com?EXTRACT" target="_blank"&gt;http://vms.process.com/scripts/fileserv/fileserv.com?EXTRACT&lt;/A&gt;</description>
    <pubDate>Thu, 13 Dec 2007 18:03:47 GMT</pubDate>
    <dc:creator>Jess Goodman</dc:creator>
    <dc:date>2007-12-13T18:03:47Z</dc:date>
    <item>
      <title>Long text file truncate</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116443#M39008</link>
      <description>I'm interested in only the first 100000 lines of a 15GB text file&lt;BR /&gt;&lt;BR /&gt;Is there any way to easily copy only this 100000 lines to another file?&lt;BR /&gt;&lt;BR /&gt;(Editing the file with TPU and trying to delete lines from 100000 onwards displays the message "Too many records")&lt;BR /&gt;&lt;BR /&gt;Thank you</description>
      <pubDate>Thu, 13 Dec 2007 17:26:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116443#M39008</guid>
      <dc:creator>Nicolau Roca</dc:creator>
      <dc:date>2007-12-13T17:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: Long text file truncate</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116444#M39009</link>
      <description>Choose a language, then write a program to&lt;BR /&gt;open the input file and the output file,&lt;BR /&gt;read a line and write it N times, and stop?&lt;BR /&gt;I assume that this could be done in C, DCL,&lt;BR /&gt;Fortran, or practically anything else you&lt;BR /&gt;have.</description>
      <pubDate>Thu, 13 Dec 2007 17:49:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116444#M39009</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2007-12-13T17:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Long text file truncate</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116445#M39010</link>
      <description>$ open infile filename&lt;BR /&gt;$ open/write outfile filename&lt;BR /&gt;$ num = 0&lt;BR /&gt;$10:&lt;BR /&gt;$ read/end_of-file=eof infile str&lt;BR /&gt;$ write outfile str&lt;BR /&gt;$ num = num + 1&lt;BR /&gt;$ if num .lt. 100000 then goto 10&lt;BR /&gt;$eof:&lt;BR /&gt;$ close infile&lt;BR /&gt;$ close outfile</description>
      <pubDate>Thu, 13 Dec 2007 17:51:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116445#M39010</guid>
      <dc:creator>Hakan Zanderau ( Anders</dc:creator>
      <dc:date>2007-12-13T17:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Long text file truncate</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116446#M39011</link>
      <description>Nicolau,&lt;BR /&gt;&lt;BR /&gt;try this:&lt;BR /&gt;&lt;BR /&gt;$EDT/EDT/NOCO big-file&lt;BR /&gt;*WRITE filename 1:100000&lt;BR /&gt;*quit&lt;BR /&gt;&lt;BR /&gt;This should write the first 100000 lines from file big-file to filename&lt;BR /&gt;&lt;BR /&gt;Volker.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Dec 2007 17:57:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116446#M39011</guid>
      <dc:creator>Volker Halle</dc:creator>
      <dc:date>2007-12-13T17:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Long text file truncate</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116447#M39012</link>
      <description>Another option if the freeware EXTRACT program.&lt;BR /&gt;&lt;A href="http://vms.process.com/scripts/fileserv/fileserv.com?EXTRACT" target="_blank"&gt;http://vms.process.com/scripts/fileserv/fileserv.com?EXTRACT&lt;/A&gt;</description>
      <pubDate>Thu, 13 Dec 2007 18:03:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116447#M39012</guid>
      <dc:creator>Jess Goodman</dc:creator>
      <dc:date>2007-12-13T18:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Long text file truncate</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116448#M39013</link>
      <description>You should be able to use SEARCH with a combination of /MATCH=EQV  /LIMIT=1000000 and /OUTPUT qualifiers to get what you want.&lt;BR /&gt;&lt;BR /&gt;$search my_big_file.txt "something"/match=eqv/limit=100000/output=my_small_file.txt&lt;BR /&gt;&lt;BR /&gt;Bill</description>
      <pubDate>Thu, 13 Dec 2007 18:39:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116448#M39013</guid>
      <dc:creator>Bill Hall</dc:creator>
      <dc:date>2007-12-13T18:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Long text file truncate</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116449#M39014</link>
      <description>&lt;BR /&gt;$ perl -pe "last if $. &amp;gt; 99999" big.dat &amp;gt; small.dat&lt;BR /&gt;&lt;BR /&gt;$ gawk /out=small.dat "(NR &amp;gt; 99999){exit} {print $0}" big.dat&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Dec 2007 19:00:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116449#M39014</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-12-13T19:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Long text file truncate</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116450#M39015</link>
      <description>If the purpose is to get rid of the space occupied by the 14 GB garbage, I would be brave and do:&lt;BR /&gt;&lt;BR /&gt;  set file/attr=EBK:15600 file&lt;BR /&gt;  set file/truncate file&lt;BR /&gt;&lt;BR /&gt;if the the file has average lines of 80 characters.&lt;BR /&gt; (15600 = 100000/512*80)&lt;BR /&gt;&lt;BR /&gt;Delay the /TRUNC until You have verified the new size is sufficient.&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Dec 2007 14:43:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116450#M39015</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2007-12-14T14:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: Long text file truncate</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116451#M39016</link>
      <description>Hein&amp;gt; $ gawk /out=small.dat "(NR &amp;gt; 99999){exit} {print $0}" big.dat&lt;BR /&gt;&lt;BR /&gt;Or even...&lt;BR /&gt;&lt;BR /&gt;$ gawk /out=small.dat "(NR &amp;gt; 99999){exit} 1" big.dat&lt;BR /&gt;&lt;BR /&gt;Joseph&amp;gt;If the purpose is to get rid of the space occupied by the 14 GB garbage, I would be brave and do:&lt;BR /&gt;&amp;gt;&amp;gt; set file/attr=EBK:15600 file&lt;BR /&gt;&amp;gt;&amp;gt; set file/truncate file&lt;BR /&gt;&lt;BR /&gt;Right. But you _should_ try to also set the FFB, allthough it will work regardless.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; if the the file has average lines of 80 characters.&lt;BR /&gt;(15600 = 100000/512*80)&lt;BR /&gt;&lt;BR /&gt;That would be a great, IO free, first cut and likely good enough.&lt;BR /&gt;If you want to do it exactly then you can use DUMP/RECORD=(COUNT=1,START=100001) and use the RFA for the exact byte offset.&lt;BR /&gt;&lt;BR /&gt;$  pipe dum/re=(co=1,st=10) tmp.tmp | perl -ne "if (/^Re.*A\((\d+),(\d+),(\d+)/) {printf qq(set file/att=(ebk:%d,ffb:%d)&lt;BR /&gt;),$1+0x1000*$2,$3}"&lt;BR /&gt;&lt;BR /&gt;This will output something like:&lt;BR /&gt;&lt;BR /&gt;set file/att=(ebk:1,ffb:18)&lt;BR /&gt;&lt;BR /&gt;You can then apply that to the file (after first saving:&lt;BR /&gt;f$file("tmp.tmp","EOF")&lt;BR /&gt;f$file("tmp.tmp","FFB")&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Dec 2007 17:05:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116451#M39016</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-12-14T17:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Long text file truncate</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116452#M39017</link>
      <description>Wow Hein, true ...&lt;BR /&gt;on the other hand, if a runaway process is filling my disk with a 15GB logfile, I probably  won't care to cut a record somewhere after the 100000th :-)</description>
      <pubDate>Fri, 14 Dec 2007 20:00:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/long-text-file-truncate/m-p/4116452#M39017</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2007-12-14T20:00:03Z</dc:date>
    </item>
  </channel>
</rss>

