Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

go backward one line in a file

Status
Not open for further replies.

eve25

Programmer
Feb 9, 2004
32
US
Hi folks,

I there anyway in a file to go to the previous line easily? I made a fct looking for one line ans returning all the text before that line, but after I want to start again from this line and if a call $line=<FILE> it gives me the following one.. I know that seek is a possibility but it is a byte lenght as limit... that is how I did, but in case the number of bytes change...

So any help would be sincerely appreciated!
Thanks
 
Your post is a bit cryptic, but if you're trying to do what I think (?) you are, have you considered reading your file into an array, and then using array index to access the line you want? Will this work for you?
 
Sounds like a non-native English speaker. Look at File::Readbackward on cpan.org.

________________________________________
Andrew - Perl Monkey
 
Hi,
yes I am a french girl lost in Califoirnia...lol
the array stuff is not ok for me cause sometimes I have to take lines and some other time to split value on many lines... well, just thinking maybe I can concatenate the lines when I need more. I ll check also the package Andrew spoke about.

thanks guys and sorry if I it was not clear!
bye, have a good day
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top