in reply to Re: Reading from a file
in thread Reading from a file

Hello and thank you all!
A few answers:
1. yes, I'm running on linux !!
2. this is a reporter file, it gets appended all the time, every minute or so
3. the last line is the most updated(since the report row /line is added every minute), that's why I'm interested in it, and I used to read the first line too since it holds the columns name(I get the data by the column name) BUT
now I found a bug- if a change is made, and a column is added,then a new row is added (similar to the first row holding the names) but this row also holds the name of the new column, BUT it doesn't know about it since it reads the column name from the first row in the file
So, I need to change this and search the file for this row and if it's not found-I'll end up with the first one

It look something like this:
#name: time input output users connected ... 12:23 23 34 780 560 12:24 21 40 780 570 ....

Replies are listed 'Best First'.
Re^3: Reading from a file
by LanceDeeply (Chaplain) on May 23, 2006 at 13:44 UTC
    ok-
    in keeping with the *nix commands theme how about:
    # # find last row that defines the columns ( i.e. starts with #name: ) # my $column_names = qx/grep ^\#name $filename | tail -1/; print $column_names;
    -hth