<?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 How to chop off the last part of a large file? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003709#M127002</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;I need to chop off the last part of a very large file. The file is so large that I can't copy and move it back into place. Does anyone know of a command to allow me to do this to a file without a copy?&lt;BR /&gt;&lt;BR /&gt;TIA,&lt;BR /&gt;John</description>
    <pubDate>Fri, 20 Jun 2003 17:32:40 GMT</pubDate>
    <dc:creator>John Wolfe_1</dc:creator>
    <dc:date>2003-06-20T17:32:40Z</dc:date>
    <item>
      <title>How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003709#M127002</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;I need to chop off the last part of a very large file. The file is so large that I can't copy and move it back into place. Does anyone know of a command to allow me to do this to a file without a copy?&lt;BR /&gt;&lt;BR /&gt;TIA,&lt;BR /&gt;John</description>
      <pubDate>Fri, 20 Jun 2003 17:32:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003709#M127002</guid>
      <dc:creator>John Wolfe_1</dc:creator>
      <dc:date>2003-06-20T17:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003710#M127003</link>
      <description>The tail command has always worked for me.&lt;BR /&gt;&lt;BR /&gt;tail &lt;NUMBER of="" lines=""&gt; filename &amp;gt; newfile&lt;BR /&gt;&lt;BR /&gt;SEP&lt;/NUMBER&gt;</description>
      <pubDate>Fri, 20 Jun 2003 17:34:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003710#M127003</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-06-20T17:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003711#M127004</link>
      <description>John,&lt;BR /&gt;  There any many options.&lt;BR /&gt;&lt;BR /&gt;  You can use split to split the files into many chunks(files).  check man split.&lt;BR /&gt;&lt;BR /&gt;  You can view say first 100 lines using head -100 server.out&lt;BR /&gt;&lt;BR /&gt;  You can also use tail to see the last part of the file say 100 lines from below tail -100 server.out.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Umapathy&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jun 2003 17:36:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003711#M127004</guid>
      <dc:creator>Umapathy S</dc:creator>
      <dc:date>2003-06-20T17:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003712#M127005</link>
      <description>tail -n number_of_lines large_file &amp;gt; new_file</description>
      <pubDate>Fri, 20 Jun 2003 17:36:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003712#M127005</guid>
      <dc:creator>Paul Sperry</dc:creator>
      <dc:date>2003-06-20T17:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003713#M127006</link>
      <description>Because it relies on the underlying truncate() system call which is not implemented in all flavor of UNIX, this is not a universal solution BUT it will work in HP-UX (and most modern UNIX's):&lt;BR /&gt;&lt;BR /&gt;perl -e 'truncate("myfile",10000000)'&lt;BR /&gt;&lt;BR /&gt;This will chop off everything in "myfile" beyond the 10,000,000th byte.&lt;BR /&gt;&lt;BR /&gt;Man 2 truncate for details.&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jun 2003 17:38:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003713#M127006</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-06-20T17:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003714#M127007</link>
      <description>I think it should read:&lt;BR /&gt;&lt;BR /&gt;tail -N file &amp;gt; lastN.file</description>
      <pubDate>Fri, 20 Jun 2003 17:38:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003714#M127007</guid>
      <dc:creator>Elena Leontieva</dc:creator>
      <dc:date>2003-06-20T17:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003715#M127008</link>
      <description>Hi Steven:&lt;BR /&gt;&lt;BR /&gt;I guess I was not very clear. I want to keep the first part of a file and discard the last parts without rewriting the file. I would really like to chop a file off at say line 900000 and do the operation "in place".&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;John&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jun 2003 17:42:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003715#M127008</guid>
      <dc:creator>John Wolfe_1</dc:creator>
      <dc:date>2003-06-20T17:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003716#M127009</link>
      <description>Clays example will do exactly that.  It looks like it's just using a temporary space and replacing the original file.  No copy or redirect required.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jun 2003 17:52:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003716#M127009</guid>
      <dc:creator>Jim Mallett</dc:creator>
      <dc:date>2003-06-20T17:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003717#M127010</link>
      <description>John:&lt;BR /&gt;&lt;BR /&gt;You can use the head command. See the man pages for more information. It does the opposite than the tail command. &lt;BR /&gt;&lt;BR /&gt;head -n 100 filename &amp;gt; newfilname&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dario</description>
      <pubDate>Fri, 20 Jun 2003 18:01:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003717#M127010</guid>
      <dc:creator>Dario_1</dc:creator>
      <dc:date>2003-06-20T18:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003718#M127011</link>
      <description>Actually, truncate() doesn't use any temporary space. It just goes out to a given offset and WHAM - the ax falls. The remaining data is returned to the filesystem as free space. The tricky part will be converting the start of a line number into an offset - but that ain't so hard either.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jun 2003 18:02:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003718#M127011</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-06-20T18:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003719#M127012</link>
      <description>Hello!&lt;BR /&gt;&lt;BR /&gt;The perl function truncate will help you&lt;BR /&gt;and as A. Clay Stephenson writen that it's&lt;BR /&gt;not suporten on all kind of unix systems&lt;BR /&gt;you also have library that implement truncate&lt;BR /&gt;for c/c++ that you could use not shure about&lt;BR /&gt;the name something about filetools.&lt;BR /&gt;&lt;BR /&gt;Caesar</description>
      <pubDate>Fri, 20 Jun 2003 18:06:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003719#M127012</guid>
      <dc:creator>Caesar_3</dc:creator>
      <dc:date>2003-06-20T18:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003720#M127013</link>
      <description>Thanks for the clarification Clay.  I have a few points set aside here next time you respond to one of my threads.&lt;BR /&gt;&lt;BR /&gt;Can't wait to finally get time to open the Perl books.  &lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jun 2003 18:13:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003720#M127013</guid>
      <dc:creator>Jim Mallett</dc:creator>
      <dc:date>2003-06-20T18:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003721#M127014</link>
      <description>Hi John!&lt;BR /&gt;&lt;BR /&gt;Please disregard my approach since you will have to re-direct to a file.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dario</description>
      <pubDate>Fri, 20 Jun 2003 18:17:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003721#M127014</guid>
      <dc:creator>Dario_1</dc:creator>
      <dc:date>2003-06-20T18:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003722#M127015</link>
      <description>you can give this a try:&lt;BR /&gt;&lt;BR /&gt;num=9000001  #number of lines to save + 1.&lt;BR /&gt;&lt;BR /&gt;ex -s +"$num,$ d|wq" $yourfile&lt;BR /&gt;&lt;BR /&gt;of course you might want to do some testing to verify there is at least $num lines in your file before doing this.  and, I would guess that ex does create a scratch file copy of $yourfile in /var/tmp, so you'll need some free disk space there.&lt;BR /&gt;&lt;BR /&gt; I'm sure there is a way to remove lines in place using perl also.</description>
      <pubDate>Fri, 20 Jun 2003 18:21:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003722#M127015</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-06-20T18:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003723#M127016</link>
      <description>Of course the perl example is perfect, but it chops the file after 10_000_000 *bytes*. This example will truncate after 9_000 *lines*:&lt;BR /&gt;&lt;BR /&gt;# perl -e'$f=$ARGV[0];&amp;lt;&amp;gt;for 1..9_000;truncate$f,tell' file_to_truncate&lt;BR /&gt;&lt;BR /&gt;example is for 1 file only!&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jun 2003 18:39:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003723#M127016</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-06-20T18:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003724#M127017</link>
      <description>Thanks Procura. You get the 10 points! I couldn't quite figure out how to get the lines converted to bytes. A Clay hinted that it was easy but I guess he was waiting for me to figure it out myself.&lt;BR /&gt;&lt;BR /&gt;Thanks to all,&lt;BR /&gt;John</description>
      <pubDate>Fri, 20 Jun 2003 19:06:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003724#M127017</guid>
      <dc:creator>John Wolfe_1</dc:creator>
      <dc:date>2003-06-20T19:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003725#M127018</link>
      <description>Actually I'm too dumb to figure out that trick so like a good teacher I leave that as an exercise for the students and let them think I know how to do it.&lt;BR /&gt;&lt;BR /&gt;My second reason was that I question the need for such a command unless one might want to intentionally truncate a log to hide one's tracks in which case he would be well advised to make sure ctime, mtime, and atime are 'fixed' as well.&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jun 2003 19:12:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003725#M127018</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-06-20T19:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop off the last part of a large file?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003726#M127019</link>
      <description>Hello!&lt;BR /&gt;&lt;BR /&gt;To figure out the size of line you will&lt;BR /&gt;need to know the size of line that's mean&lt;BR /&gt;scan all file and get size of every line&lt;BR /&gt;than in the end truncate what you want to&lt;BR /&gt;remove.&lt;BR /&gt;&lt;BR /&gt;Best for you is to made the whole script on perl.&lt;BR /&gt;&lt;BR /&gt;Caesar</description>
      <pubDate>Fri, 20 Jun 2003 19:33:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-chop-off-the-last-part-of-a-large-file/m-p/3003726#M127019</guid>
      <dc:creator>Caesar_3</dc:creator>
      <dc:date>2003-06-20T19:33:47Z</dc:date>
    </item>
  </channel>
</rss>

