Author |
Message |
Tom Phoeni #1 / 9
|
 read last line without reading previous lines, how?
Quote: > I wonder how to reading the last line of a text file, without going > through the previous lines.
This FAQ entry has some info about that. Hope this helps! http://www.*-*-*.com/ How_do_I_change_one_line_in_a_fi.html -- Tom Phoenix http://www.*-*-*.com/ ~rootbeer/
Randal Schwartz Case: http://www.*-*-*.com/
|
Sun, 02 Jan 2000 03:00:00 GMT |
|
 |
Chuan Wa #2 / 9
|
 read last line without reading previous lines, how?
Hi, I wonder how to reading the last line of a text file, without going through the previous lines. Thanks.
|
Sun, 02 Jan 2000 03:00:00 GMT |
|
 |
Helmut Jaraus #3 / 9
|
 read last line without reading previous lines, how?
|> Hi, |> |> I wonder how to reading the last line of a text file, without going through |> the previous lines. Thanks. Look up the man pages for 'seek', there is a mode to seek to the end of a file. -- Helmut Jarausch Lehrstuhl f. Numerische Mathematik Institute of Technology, RWTH Aachen D 52056 Aachen, Germany
|
Tue, 04 Jan 2000 03:00:00 GMT |
|
 |
Jeff Wilso #4 / 9
|
 read last line without reading previous lines, how?
Try ...
-- Jeff Wilson London - UK
Quote: Wang) writes:
: |> Hi, : |> : |> I wonder how to reading the last line of a text file, without going through : |> the previous lines. Thanks. : : Look up the man pages for 'seek', there is a mode to seek to the end of a file. : -- : Helmut Jarausch : Lehrstuhl f. Numerische Mathematik : Institute of Technology, RWTH Aachen : D 52056 Aachen, Germany :
|
Sun, 09 Jan 2000 03:00:00 GMT |
|
 |
Tom Phoeni #5 / 9
|
 read last line without reading previous lines, how?
Quote: > Subject: Re: read last line without reading previous lines, how? > Try ... > open(TXT,"<textfile");
That doesn't read the last line without reading previous lines. You should
should be referenced as $fred[-1] . Thanks for trying! -- Tom Phoenix http://www.teleport.com/~rootbeer/
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
|
Sun, 09 Jan 2000 03:00:00 GMT |
|
 |
Scott Blankstee #6 / 9
|
 read last line without reading previous lines, how?
Quote:
> Try ... > open(TXT,"<textfile");
Don't forget to check the return value of open...
But this reads *all* the lines in textfile... Quote:
> : |> I wonder how to reading the last line of a text file, without > going through > : |> the previous lines. Thanks.
Scott -- Scott I. Blanks{*filter*} sib (at) worldnet (dot) att (dot) net
|
Sun, 09 Jan 2000 03:00:00 GMT |
|
 |
Bob Wilkins #7 / 9
|
 read last line without reading previous lines, how?
Quote:
Wang) writes: > |> Hi, > |> > |> I wonder how to reading the last line of a text file, without going through > |> the previous lines. Thanks. > Look up the man pages for 'seek', there is a mode to seek to the end of a file. > -- > Helmut Jarausch > Lehrstuhl f. Numerische Mathematik > Institute of Technology, RWTH Aachen > D 52056 Aachen, Germany
or use system "tail","-1",$file; #?or some such variant Bob -- .sig file on holiday
|
Sun, 09 Jan 2000 03:00:00 GMT |
|
 |
x.. #8 / 9
|
 read last line without reading previous lines, how?
Quote:
>> open(TXT,"<textfile"); >Don't forget to check the return value of open...
>But this reads *all* the lines in textfile...
>> : |> I wonder how to reading the last line of a text file, without >> going through >> : |> the previous lines. Thanks.
The only method which is system independant would be to fseek() to the end of the file, and then iterate back one byte at a time until you hit a newline- you could even build the line as you go (backwards, of course).
|
Mon, 10 Jan 2000 03:00:00 GMT |
|
 |
Mark A Johnso #9 / 9
|
 read last line without reading previous lines, how?
a similar question is: "how can i read a file from last line to first?" i'm probably looking for a pre-written function that doesn't store the entire file in an array, and it doesn't step through the entire file for each line. thanks. Quote:
> Try ... > open(TXT,"<textfile");
> -- > Jeff Wilson > London - UK
> (Chuan > Wang) writes: > : |> Hi, > : |> > : |> I wonder how to reading the last line of a text file, without > going through > : |> the previous lines. Thanks. > : > : Look up the man pages for 'seek', there is a mode to seek to the end > of a file. > : -- > : Helmut Jarausch > : Lehrstuhl f. Numerische Mathematik > : Institute of Technology, RWTH Aachen > : D 52056 Aachen, Germany > :
|
Tue, 11 Jan 2000 03:00:00 GMT |
|
|