Reading a txt file and echo'ing a line
Posted: Mon Oct 11, 2010 10:38 am
Dear Forum,
I have a script that is out-putting a text file, I want to parse the text file and then echo one of the lines to the browser
The file lives in '/mnt/app/out/php/file.txt'
The file.txt is in the following format: -
-------------------------------------------------------------------------------------------------------------
Welcome to World Agent 1.00
password:
WTA> KHATIB,Khatib,N,EN,28,0,0,0,,N,60,,,N,0,,0,,,,STTDM,,,0,0,0,,,0,,0
WTA> Goodby
-------------------------------------------------------------------------------------------------------------
So first line/line 0 is blank, and there are 9 lines altogether
I want to echo line 6 to the browser (with first line being 0)
Even better would be if I could just echo part of line - Khatib,N,EN,28,
Could anyone please let me know what function could achieve this and possibly an example incorporating the above?
I have tried file() and explode but I am not getting very good results.
Many thanks
I have a script that is out-putting a text file, I want to parse the text file and then echo one of the lines to the browser
The file lives in '/mnt/app/out/php/file.txt'
The file.txt is in the following format: -
-------------------------------------------------------------------------------------------------------------
Welcome to World Agent 1.00
password:
WTA> KHATIB,Khatib,N,EN,28,0,0,0,,N,60,,,N,0,,0,,,,STTDM,,,0,0,0,,,0,,0
WTA> Goodby
-------------------------------------------------------------------------------------------------------------
So first line/line 0 is blank, and there are 9 lines altogether
I want to echo line 6 to the browser (with first line being 0)
Even better would be if I could just echo part of line - Khatib,N,EN,28,
Could anyone please let me know what function could achieve this and possibly an example incorporating the above?
I have tried file() and explode but I am not getting very good results.
Many thanks