Created
February 14, 2025 12:57
-
-
Save adamcameron/0009f5e52eb99e6d34a293a0d19fb098 to your computer and use it in GitHub Desktop.
dediff.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fromLive = fopen('../var/tmp/from_live.csv', 'r'); | |
$fromTest = fopen('../var/tmp/from_test.csv', 'r'); | |
$fromLiveSame = fopen('../var/tmp/from_live_same.csv', 'w'); | |
$fromTestSame = fopen('../var/tmp/from_test_same.csv', 'w'); | |
$fromLiveDiff = fopen('../var/tmp/from_live_diff.csv', 'w'); | |
$fromTestDiff = fopen('../var/tmp/from_test_diff.csv', 'w'); | |
while (($lineLive = fgets($fromLive)) !== false) { | |
$lineTest = fgets($fromTest); | |
if ($lineTest === false || trim($lineLive) !== trim($lineTest)) { | |
fwrite($fromLiveDiff, $lineLive); | |
if ($lineTest !== false) { | |
fwrite($fromTestDiff, $lineTest); | |
} | |
} else { | |
fwrite($fromLiveSame, $lineLive); | |
fwrite($fromTestSame, $lineTest); | |
} | |
} | |
while (($lineLive = fgets($fromLive)) !== false) { | |
fwrite($fromLiveDiff, $lineLive); | |
} | |
fclose($fromLive); | |
fclose($fromTest); | |
fclose($fromLiveSame); | |
fclose($fromTestSame); | |
fclose($fromLiveDiff); | |
fclose($fromTestDiff); | |
echo "Comparison complete.\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment