Ask a Question related to PHP Development, Design and Development.
-
W. Paulisse #1
read lines of file without parsing the lines
Hello!
Currently i have a logfile which tracks a certain feature on my server.
Every time the feature accurs my script appends a line in the file.
Can i find out how many lines the log file currently contains without
opening the complete file en count every line in a loop?
I want to do this because reading the file every time can take a long time.
the log file is emptied every week but on the end of the week the file
contains more than 20.000 lines.
Thanks in Afvance
W. Paulisse
W. Paulisse Guest
-
Add lines to pages in a file
Ok, I've heard that I can do this with templates. But I'm not sure how to do this. Here is what I want to have. I have a PDF with several pages. Each... -
Vertical lines in AI graphics PDF as broken lines?
I have an InDesign CS1 doc that has an Illustrator CS1 EPS file placed in it. The graphic is a barcode for a coupon. It is only many vertical lines,... -
Acrobat 6 changes solid lines to dashed lines
Is Adobe planning to provide a fix for the problem where solid lines will display as dashed lines when viewed in Acrobat 6? If yes, when? Thank... -
Help parsing multiple lines?
I have to cut and paste lots of contact info into a FMP database. I copy text from multiple sources and paste it into my database one line at a... -
Newbie - skipping lines of a file.
tadmc@augustmail.com (Tad McClellan) writes: The irony is that I somehow failed to recognise this as a FAQ! I just answered the question... -
Savut #2
Re: read lines of file without parsing the lines
I dont know any function doing this in fast way. But If you want something
simple, check how I do it :
$file = file("file.txt");
$numLine = count($file);
Savut
"W. Paulisse" <ihate@spam.nl> wrote in message
news:40295482$0$575$e4fe514c@news.xs4all.nl...time.> Hello!
>
> Currently i have a logfile which tracks a certain feature on my server.
> Every time the feature accurs my script appends a line in the file.
>
> Can i find out how many lines the log file currently contains without
> opening the complete file en count every line in a loop?
>
> I want to do this because reading the file every time can take a long> the log file is emptied every week but on the end of the week the file
> contains more than 20.000 lines.
>
> Thanks in Afvance
> W. Paulisse
>
>Savut Guest
-
CountScubula #3
Re: read lines of file without parsing the lines
Super simple way is to pad every line with spaces so each line is always the
same length
then lines = file size / (line lenght +1 )
the +1 is for the new line chr \n or +2 on windows \r\n
--
Mike Bradley
[url]http://www.gzentools.com[/url] -- free online php tools
"W. Paulisse" <ihate@spam.nl> wrote in message
news:40295482$0$575$e4fe514c@news.xs4all.nl...time.> Hello!
>
> Currently i have a logfile which tracks a certain feature on my server.
> Every time the feature accurs my script appends a line in the file.
>
> Can i find out how many lines the log file currently contains without
> opening the complete file en count every line in a loop?
>
> I want to do this because reading the file every time can take a long> the log file is emptied every week but on the end of the week the file
> contains more than 20.000 lines.
>
> Thanks in Afvance
> W. Paulisse
>
>
CountScubula Guest
-
thunder #4
Re: read lines of file without parsing the lines
"W. Paulisse" <ihate@spam.nl> wrote in message
news:40295482$0$575$e4fe514c@news.xs4all.nl...> Hello!If your server OS is a *nix variant, you might like to try this:> Can i find out how many lines the log file currently contains without
> opening the complete file en count every line in a loop?
$numlines = intval(`wc -l /path/to/logfile`);
Cheers,> W. Paulisse
thunder
thunder Guest



Reply With Quote

