Hi all,
I must compare two .js files that have the format below:
However, when BC3 spots a difference, it always shows the whole line. That's not very useful for long lines, because I have to scroll horizontally to see which are the different words (incidentally, anyone knows a way to show only the different words / characters? I'd love to see this feature). So I created a very simple PHP script that breaks all lines, like this:
In BC, I've created a new text format, then added the command line above to the 'Loading' field that exists in the Conversion tab. This script breaks all source lines into separate words in the target file, one per line. This way I can see only the relevant differences: that's exactly what I wanted. Adding extra processing is easy, just include more str_replace() or preg_replace() commands.
Hope this is useful to someone!
I must compare two .js files that have the format below:
Code:
var item = [ ['pagefile1.html', 'Page Name 1', 'keyword1, keyword2, keyword3, ...'], ['pagefile2.html', 'Page Name 2', 'keyword4, keyword5, keyword6, ...'], // etc. ];
Code:
<?php // Very simple PHP script to convert commas to line breaks // Usage in BC3: C:\php5\bin\php.exe C:\php5\scripts\search.php %s %t $source = file($argv[1]); $target = array(); foreach($source as $line) { $line = str_replace(",", PHP_EOL, $line); // ... Additional processing goes here $target[] = $line; } file_put_contents($argv[2], $target); ?>
Hope this is useful to someone!
Comment