#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    0
    Rep Power
    0
    Hello!

    How i can read a text file lines and take just some words on it.
    Example.

    |__6__|2|_4_|2|___8____|_6__|
    XXX11102TEXT03TEXTMORE100110

    how i can take first 6 and then "TEXTMORE" 8 characters . . .


    [This message has been edited by JayPacino (edited November 21, 2000).]

    [This message has been edited by JayPacino (edited November 21, 2000).]
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    3
    Rep Power
    0
    If you know where each word begin, you can use

    $Content= file("sth.txt");
    $Lines= sizeof($Content);

    for ($n=0; $n<$Lines; $n++) {
    $first = substr($Content[$n], begin, width);}

    //eg.
    //$first= substr($Content[$n],0,6);
    //$second= substr($Content[$n],7,8);
    //....

    But it's no so good if you have to read more than a few words...

    [This message has been edited by Gregxxx68 (edited November 21, 2000).]

    [This message has been edited by Gregxxx68 (edited November 21, 2000).]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    0
    Rep Power
    0
    Thanks, that will help me, but is there some better way if i have about 150 lines and i have to go it thrue line by line.
    Every words has same begin and end points in lines.

IMN logo majestic logo threadwatch logo seochat tools logo