>
> On Aug 31, Jim said:
>
> >open (FILE, "+>", $file) or die "cannot open $file: $!";
>
> I think you want "+>>" there, or else it will overwrite the
> contents of the file and you won't be able to determine how
> many lines there were originally.
Thanks. I was not sure what he was tryin
On Aug 31, Jim said:
>open (FILE, "+>", $file) or die "cannot open $file: $!";
I think you want "+>>" there, or else it will overwrite the contents of
the file and you won't be able to determine how many lines there were
originally.
>flock (FILE, 2) or die "cannot flock $file: $!";
For safety'
On Aug 31, [EMAIL PROTECTED] said:
>Well if all you want to do is count the number of lines in the file then
>zero out the file, the easiest way that I can think of would be to use a
>couple of system calls like this.
No, there is no reason to make any system calls at all.
open FILE, "< $file"
On Aug 31, [EMAIL PROTECTED] said:
>open(FILE, "> $logfile") or die "Couldn't open $logfile : $!\n"; # This
> logfile keeps appending in a linux m/c
>flock(FILE,2);
>while (sysread FILE, $buffer, 4096) {
> $lines += ($buffer =~ tr/\n//);
>}
This ma
> Hi ,
> I have a problem in deleting all the lines in a file and saving it .
> Actually my log file keep appending all the messages for that
> i need to clean it up i.e delete all lines in it save it .
> when i do this initially file shows zero bytes , but as soon
> as the next message append
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 31, 2004 6:50 AM
To: [EMAIL PROTECTED]
Subject: delete all lines in a file save it come out
Hi ,
I have a problem in deleting all the lines in a file and saving it .
Actually my log file keep
Hi ,
I have a problem in deleting all the lines in a file and saving it .
Actually my log file keep appending all the messages for that i need to
clean it up i.e delete all lines in it save it . when i do this initially
file shows zero bytes , but as soon as the next message appends ,, file
sizes j