|
Posted by lorento on 11/16/06 03:10
Advo wrote:
>
> MNs73dd78INFORMATION I NEED 32427 12759 39384425 495242 15.206412
> 0.191214 44.164503 -93.993798
>
> As you can see, its pretty messed up. I only need the "INFORMATION I
> NEED" part, not the 9 characters before, nor any numbers or decimal
> places afterwards.
>
You can use regex maybe like this (not tested yet):
<?php
$fr = fopen ("data.txt", "r");
$fw = fopen ("data_clean.txt", "a");
while (!feof($fr))
{
$ln = fgets($fr, 1024);
$ln = preg_replace ("/^(\w{9})(.*)(\d+)/", "$2", $ln);
fwrite($fw, $ln);
}
fclose($fr);
fclose($fw);
?>
--
http://www.mastervb.net
http://www.theaussiemap.com
Navigation:
[Reply to this message]
|