Hi All,
I need to truncate last few bytes of file. these files are big in size.
One idea is to write needed bytes to another file and delete the original
file, but i am dealing with big files :(
dont want to use truncate, it just truncating the size, all data is gone
any pointers
Thanks
a b
On Fri, May 20, 2011 at 03:40:35PM +0530, a b wrote:
Hi All,
I need to truncate last few bytes of file. these files are big in size.
One idea is to write needed bytes to another file and delete the original
file, but i am dealing with big files :(
dont want to use truncate, it just
Here i paste a perl script to delete last Two Lines. If you want
delete more lines in a file you can specify it.
use File::ReadBackwards;
my $filename = 'test.txt';
my $Lines_to_truncate = 2; # Here the line to truncate is mean Remove
only Last Two Lines
my $bw = File::ReadBackwards-new(
Hey Thanks all!
I got it ;)
open (FH, + $fname)|| die \nFailed to open file $fname\n;
my $tmp=$fsize-$trunccount;
seek(FH,$tmp,0);
$addr = tell(FH) ;
truncate(FH, $addr)|| die \nFailed to truncate $file: $!;
close(fd);
print \nTruncate
Hi Ambuli,
a few comments on your code:
On Friday 20 May 2011 14:37:52 Ambuli wrote:
Here i paste a perl script to delete last Two Lines. If you want
delete more lines in a file you can specify it.
Always start with use strict; and use warnings.
use File::ReadBackwards;
Include some
On May 20, 4:37 am, cmksw...@gmail.com (Ambuli) wrote:
Here i paste a perl script to delete last Two Lines. If you want
delete more lines in a file you can specify it.
use File::ReadBackwards;
my $filename = 'test.txt';
my $Lines_to_truncate = 2; # Here the line to truncate is mean Remove
ab == a b testa...@gmail.com writes:
ab I need to truncate last few bytes of file. these files are big in size.
ab One idea is to write needed bytes to another file and delete the original
ab file, but i am dealing with big files :(
ab dont want to use truncate, it just truncating the
ab == a b testa...@gmail.com writes:
ab Hey Thanks all!
ab I got it ;)
ab open (FH, + $fname)|| die \nFailed to open file $fname\n;
you don't need to open the file at all. truncate can take a filename.
ab my $tmp=$fsize-$trunccount;
where do those get set? don't name
Dear All,
I would like a subroutine that will allow me to easily put columns of a tab
delimited file into their own arrays.
I've been calling the following repeatedly for each column:
my @array1 = getcolvals($filehandle, 0);
my @array2 = getcolvals($filehandle, 1); ...etc.
sub getcolvals {
EM == Eric Mooshagian ericmooshag...@gmail.com writes:
EM I would like a subroutine that will allow me to easily put columns
EM of a tab delimited file into their own arrays.
EM I've been calling the following repeatedly for each column:
EM my @array1 = getcolvals($filehandle, 0);
EM
10 matches
Mail list logo