Necesito de su ayuda tengo este código y me captura una serie de datos entre letras y números pero solo quiero capturar los números este es un pequeño ejemplo
"Archivo que se genera"
Voi ys m na : UN BCMS IL EP T ACD SPEE AN ABAN TAL AFTE LO LO AUX/ VG ERV
DAY CALL ANS LL TIME TIM CALL N UT OTHE TAFF EVL
6/28/12 56 0:08 1 0:09 3:23 0:00 10 22 242:02 1.1 90
6/29/12 47 0:25 16 2:45 4:40 0:00 0 3 530:59 1.1 64
6/30/12 0 0:00 0 0:00 0:00 0:00 0 0 0:00 0.0
7/01/12 0 0:00 0 0:00 0:00 0:00 0 0 0:00 0.0
7/02/12 0 0:00 0 0:00 0:00 0:00 0 0 0:00 0.0
7/03/12 28 0:05 0 0:00 4:38 0:00 0 1 611:57 1.2 93
7/04/12 0 0:00 0 0:00 0:00 0:00 0 0 0:00 0.0
------- ---- ---- -- ---- ---- ---- -- -- ------ ---- ---
y como quiero que quede
6/28/12 56 0:08 1 0:09 3:23 0:00 10 22 242:02 1.1 90
6/29/12 47 0:25 16 2:45 4:40 0:00 0 3 530:59 1.1 64
6/30/12 0 0:00 0 0:00 0:00 0:00 0 0 0:00 0.0
7/01/12 0 0:00 0 0:00 0:00 0:00 0 0 0:00 0.0
7/02/12 0 0:00 0 0:00 0:00 0:00 0 0 0:00 0.0
7/03/12 28 0:05 0 0:00 4:38 0:00 0 1 611:57 1.2 93
7/04/12 0 0:00 0 0:00 0:00 0:00 0 0 0:00 0.0
Les dejo el codigo
Código PHP:
<?php
include("conexion.php");
$link=conexion();
$gestor = @fopen("REPORTES/Reporte_Ultimos7_dias.txt", "r");//tarificacion04202012.txt
if ($gestor) {
$i=
$cod=0;
echo "<table border='1' align='center'>";
echo "<tr>";
echo "<td>cod</td><td>Date</td><td>Time</td><td>Sec_dur</td><td>Cond_code</td><td>Calling_num</td><td>Dialed_num</td><td>Auth_code</td><td>in_trk_code</td><td>in_crt_id</td><td>Code_used</td><td>Out_crt_id</td><td>Out_crt</td>";
echo "</tr>";
//pag 70 http://www.edwardybella.com/archivos/crepusculo.pdf
//http://www.cs101-class.org/#
while (($buffer = fgets($gestor, 999)) !== false) {
//$resultado=preg_split('/[A-z|;]/', $buffer[1]);
// if (($i % 2) != 0) {
$Date=substr($buffer, 0,7);
$Time=substr($buffer, 11,5);
$Sec_dur=substr($buffer, 18,4);
$Cond_code=substr($buffer, 26,2);
$Calling_num=substr($buffer, 30,4);
$Dialed_num=substr($buffer, 36,4);
//echo "<br>";
//echo $Dialed_num;
$Auth_code=substr($buffer, 44,4);
$in_trk_code=substr($buffer, 51,2);
$in_crt_id=substr($buffer, 56,2);
$Code_used=substr($buffer, 60,6);
$Out_crt_id=substr($buffer, 69,4);
$Out_crt=substr($buffer, 75,3);
$Date=trim($Date);//Date
$Time=trim($Time);//Time
$Sec_dur=trim($Sec_dur);//Sec-dur
$Cond_code=trim($Cond_code);//Cond-code
$Calling_num=trim($Calling_num);//Calling-num
$Dialed_num=trim($Dialed_num);//Dialed-num
$Auth_code=trim($Auth_code);//Auth-code
$in_trk_code=trim($in_trk_code);//in-trk-code
$in_crt_id=trim($in_crt_id);//in-crt_id
$Code_used=trim($Code_used);//Code-used
$Out_crt_id=trim($Out_crt_id);//Out-crt-id
$Out_crt=trim($Out_crt);//Out-crt
if($Cond_code!="D" && $Cond_code!=""){
echo "<tr>";
echo "<td>".$cod."</td>";
echo "<td>".$Date."</td>";
echo "<td>".$Time."</td>";
echo "<td>".$Sec_dur."</td>";
echo "<td>".$Cond_code."</td>";
echo "<td>".$Calling_num."</td>";
echo "<td>".$Dialed_num."</td>";
echo "<td>".$Auth_code."</td>";
echo "<td>".$in_trk_code."</td>";
echo "<td>".$in_crt_id."</td>";
echo "<td>".$Code_used."</td>";
echo "<td>".$Out_crt_id."</td>";
echo "<td>".$Out_crt."</td>";
echo "</tr>";
$cod++;
if($Auth_code==""){
$Auth_code=0;
}
if($Code_used==""){
$Code_used=0;
}
if($Out_crt_id==""){
$Out_crt_id=0;
}
if($in_crt_id==""){
$in_crt_id=0;
}
if($in_trk_code==""){
$in_trk_code=0;
}
$mysql=mysql_query("INSERT INTO estados (dato1,dato2 ,dato3,dato4,dato5,dato6,dato7,dato8,dato9,dato10,dato11) VALUES ('$Date','$Time','$Sec_dur','$Cond_code','$Calling_num','$Dialed_num', '$Auth_code','$in_trk_code','$in_crt_id','$Code_used','$Out_crt_id')") or die ("problemas en el insert".mysql_error());
}
//}
$i++;
}
echo "</table>";
if (!feof($gestor)) {
echo "Error: fallo inesperado de fgets()\n";
}
fclose($gestor);
}
mysql_close($link);
?>