File Diff with SQLite Shell
While working on OkHttp3 Scripting
I needed to do a diff from the original input file, to successful cases
and rerun again for failed queries.
this is the use case we are handling here:
original input file
input.txt
We get some output in the form of
success.txt
failure.txt
what we need is to only process (input - success) input.txt
this an A-B set operation that SQL handles well:
so let´s make it into one :D
SQLite Shell
SQLite Shell is perfect for this operation, I´ve tested it at least on a 50K+ records file and it returns almost immediately :
get SQLite binaries work on a single directory if you wish
SQL file to run:
diff.sql
Check the paths to your files and run .read diff.sql
in the shell:
input.txt is now overwritten with only the remaining elements to process:
input.txt
You can rerun your script against failures,
Some can be due to network issues, timeouts that can happen in OkHttp3 Scripting, etc.
those are worth the retry :)