<?php
$files = glob("viewed_step_*.txt");
foreach ($files as $file) {
    $content = file_get_contents($file);
    if (strpos($content, 'futureLocationTS') !== false) {
        echo "=== Found in $file ===\n";
        $lines = explode("\n", $content);
        $pos = -1;
        foreach ($lines as $i => $line) {
            if (strpos($line, 'futureLocationTS') !== false) {
                $pos = $i;
                // Print some context around it
                $start = max(0, $i - 15);
                $end = min(count($lines), $i + 15);
                for ($k = $start; $k < $end; $k++) {
                    echo ($k+1) . ": " . $lines[$k] . "\n";
                }
                echo "---------------------------------\n";
            }
        }
        echo "===============================\n\n";
    }
}
