You are here: Re: Sorting Massive amounts of Data « PHP Programming Language « IT news, forums, messages
Re: Sorting Massive amounts of Data

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация