Results 1 to 3 of 3

Thread: Reading lines

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    39

    Reading lines

    I have txt file like below with hundres of lines.
    ---------------------------------------------------------------------
    0070005003 8002 08287650859220101001000003Things That Love
    0070005004 8002 08287650859220101001000104131Lattimore, Kenny
    ...
    ...
    ......
    ...
    ...
    ...
    0070005004 8002 08287650859220101006000204272Jaz, Jamey
    ---------------------------------------------------------------------


    <?PHP
    $lines = glob("C:/zipunzip/unzip/track/*.trk");

    for($i=0;$i<sizeof($lines);$i++){

    $fp=fopen($lines[$i],"r+") or die("error opening");
    $file_content =fread($fp,filesize($lines[$i]));
    fclose($fp);

    $arrContent=explode("\n",$file_content);

    for($j=0;$j<sizeof($arrContent);$j++){
    $search_term=$arrContent[$j];

    $tagfield = '0070005003';
    $pos = strpos($search_term, $findme);

    if ($tags == false) {
    echo "</br>";
    echo "TagField: ".$tagfield=substr($search_term,0,10)."</br>";
    // echo "SupplierID". $supid = substr($search_term,10,4)."</br>";
    // echo "Barcode: ".$barcode = substr($search_term,15,13)."</br>";
    // echo "SetRN".$setrn = substr($search_term,28,4)."</br>";
    // echo "Title Refrence: ".$titleref = substr($search_term,32,7)."</br>";
    // echo "Set Type: ".$settype = substr($search_term,38,2)."</br>";
    // echo "Track Title: ".$tracktitle = substr($search_term,40,119)."</br>";
    } else {
    //echo "bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla ";
    //echo "bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla ";
    }

    }

    }
    ?>

    thanks in advance

    Ramesh chaudhary
    Last edited by RameshChaudhary; Aug 16th, 2006 at 01:07 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width