Re: How to truncate few bytes of file

2011-05-23 Thread a b
Hey Thanks uri!!! Actually i have a global variable which contains information of all files and their size you have given great directions Thanks all of you!! Regards a b On Fri, May 20, 2011 at 9:39 PM, Uri Guttman wrote: > > "ab" == a b writes: > > ab> Hey Thanks all! > ab> I got

Re: How to truncate few bytes of file

2011-05-20 Thread Uri Guttman
> "ab" == a b 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 var

Re: How to truncate few bytes of file

2011-05-20 Thread Uri Guttman
> "ab" == a b 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 size, al

Re: How to truncate few bytes of file

2011-05-20 Thread a b
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 "\nTrunca

Re: How to truncate few bytes of file

2011-05-20 Thread Paul Johnson
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 j