Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Filtro por metro para archivo de CTD
<?php
$files = glob(__DIR__. '/CTD.dat/*.dat');
passthru('rm OUTPUT/*');
foreach ( $files as $file ) {
$f = fopen($file, 'r');
$txt = '';
while ( $line = fgets($f) ) {
if ( preg_match('/^\s*\d+(\.\d+)/', $line, $matches) ) {
if ( isset($matches[1]) ) {
// var_dump($matches);
if ( $matches[1] !== '.00' )
continue;
}
}
$txt.= $line;
}
fclose($f);
file_put_contents('OUTPUT/' . basename($file), $txt);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.