Separate two files into three files, each containing lines observed in both files/first file only/second file only. Programmed using Cython.
Project description
The filediffs
package
filediffs
takes two files and separates them into
- lines found in both files
- lines found only in file 1
- lines found only in file 2
Code inspired by https://www.splinter.com.au/reconcilingcomparing-huge-data-sets-with-c/ and implemented using Cython
Lines found in both files are not kept in memory but written to disk every 5.000.000 lines to preserve memory.
This way, even very large files can be separated. Only the diff has to fit in memory.
1. Installation
1.1 Pypi:
filediffs is available on pypi and can therefore be installed via pip
pip install filediffs
Currently, only wheels for Linux are build using manylinux.
On other OS, please install the package as described in the following section.
1.2 Github:
You can clone the package from Github and transpile the Cython code to C++ on your machine.
For Dependency management, Pipenv is used.
The Pipfile defines the python version and package requirements.
You can create a virtual environment for the package with Pipenv by
- installing pipenv
pip install pipenv
- calling
pipenv install
to install from Pipfile.lock
The file setup.py
defines the cython build process.
The cpp files can be build using pipenv run python setup.py build_ext --inplace
.
2. Usage:
2.1 Interactive in Python
The file_diffs
function requires two arguments, filename_1
and filename_2
, with the path to the files you wish to compare.
In addition, three optional output arguments can be passed to the functions, defining the output files.
If the output arguments are not passed to the function, the output will be saved into the working directory.
from filediffs.filediffs_python.filediffs import file_diffs
file_diffs(
filename_1='path/to/file1.txt',
filename_2='path/to/file2.txt',
outpath_lines_present_in_both_files='output_path/to/lines_in_both.txt',
outpath_lines_present_only_in_file1='output_path/to/lines_only_in_file1.txt',
outpath_lines_present_only_in_file2='output_path/to/lines_only_in_file2.txt',
)
2.2 From the terminal
The filediffs
package comes with a build in command line interface. This way it can be used to separate files from the terminal:
# To separate two files, simply install the package with pip
pip install filediffs
# and call
filediffs path/to/file1.txt path/to/file2.txt
# If you want to define the filenames of the separated ouput files, optional arguments are provided for the script.
filediffs path/to/file1.txt path/to/file2.txt --out_filename_both both_files.txt --out_filename_only_in_file1 file1_only.txt --out_filename_only_in_file2 file2_only.txt
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file filediffs-0.1.12.tar.gz
.
File metadata
- Download URL: filediffs-0.1.12.tar.gz
- Upload date:
- Size: 40.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d8fd1bd821721cf1d2d3599724c47cdc4933065c0ce09bd1a79ae0da6b8d5be |
|
MD5 | 778761a6a6a769de45e231877cbe0b08 |
|
BLAKE2b-256 | 3cda7f762433c668d87aa4f9814a51ec8c4846da3d99049f546f8937e3ee113b |
File details
Details for the file filediffs-0.1.12-pp36-pypy36_pp73-win32.whl
.
File metadata
- Download URL: filediffs-0.1.12-pp36-pypy36_pp73-win32.whl
- Upload date:
- Size: 56.7 kB
- Tags: PyPy, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2aa5ab51b917161c3e922dd25fde42c4324dadd0cbdd3beda9bd899a2607ccd |
|
MD5 | b6eccd2f411a8d561beaa59132b04913 |
|
BLAKE2b-256 | ed0a7a22600de010f867c43f41fa2ad25f3bc8cffcc317d6b388cada2a9aee4b |
File details
Details for the file filediffs-0.1.12-cp39-cp39-manylinux2010_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp39-cp39-manylinux2010_x86_64.whl
- Upload date:
- Size: 167.4 kB
- Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38e288c07567e4f90f8755eaca8c5b464ba77518a1e4db7cc68d7c9c2f185ace |
|
MD5 | 40a20e898388c09cf2887cae9c747a4c |
|
BLAKE2b-256 | 441920b71a7505bd804f7dec36128c57b7c6de23dff13c41611dce3a8ff7dd5a |
File details
Details for the file filediffs-0.1.12-cp39-cp39-manylinux1_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp39-cp39-manylinux1_x86_64.whl
- Upload date:
- Size: 122.5 kB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26698ee34ac382ca98c1aaddf5f96f44b5b2fde5db6031d19d6b1827f71102cd |
|
MD5 | 2bc29f256e212e0d8b4c8151b2dff7f2 |
|
BLAKE2b-256 | 0e2f01cde37b2f102cedde9ad8f59d5333b27a9d74b4553563fc67446697167a |
File details
Details for the file filediffs-0.1.12-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 63.7 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7181166793c8a4204ef068103526cb5ddaa9483f8bb7164c6effa05261c888fb |
|
MD5 | 51d195b190f0c732e9b40ef269e5e414 |
|
BLAKE2b-256 | a88a063a0aefe81da6ca32a7cfd73bbbfa7107f27902706afb74f8a6d8f09892 |
File details
Details for the file filediffs-0.1.12-cp38-cp38-win32.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp38-cp38-win32.whl
- Upload date:
- Size: 61.0 kB
- Tags: CPython 3.8, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 419719c795b9e20192258688058e0ad2414c73f90a6e8b96db3c98e6fbbd15f7 |
|
MD5 | e8db34c871f1c3eaecf8a54bda19d90c |
|
BLAKE2b-256 | a065bbed633ce1d2d5008e22dd43966beb9add0f4f9bc915fa9f7525863b3865 |
File details
Details for the file filediffs-0.1.12-cp38-cp38-manylinux2010_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp38-cp38-manylinux2010_x86_64.whl
- Upload date:
- Size: 169.9 kB
- Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9943afc3cf60ef42a954969253b64f062232a99a4bcfb642e1de784b156257cb |
|
MD5 | 54f697d1193305404295ade834bc72d6 |
|
BLAKE2b-256 | 8effa98c6cb2a066a73a4f939990f5c70c33b272b5f42a07a43714c96c194d09 |
File details
Details for the file filediffs-0.1.12-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 126.9 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16eaf53177a4284f8b1da9a968ee38c1fd6966f9f949b89898979be9d3446df1 |
|
MD5 | 6e5ca2318fbda9a3a945ccbe385b1ef3 |
|
BLAKE2b-256 | 557a772ed44f8b998c17cbb6c1071b7f191a5e7c7fb91793f7085cd8980e8137 |
File details
Details for the file filediffs-0.1.12-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 57.0 kB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a2c892d24cd9eb29062dcec7ec69adf747b7c33a624f14aa14b45fcb174ae47 |
|
MD5 | 558ba475cef6e9819c215d85bd1dfdce |
|
BLAKE2b-256 | f90e7b104a6ff9adeeb2e0dbb8b54ac3aba99c9cbbfa94ed88e8b81d31f32462 |
File details
Details for the file filediffs-0.1.12-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 62.9 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d939187fda7cec50e236af394e753ebc83af225f94088663fa3a67dc9b64ad82 |
|
MD5 | bc05ceca2b902a466b16349805b86cee |
|
BLAKE2b-256 | 465c677b5406874660703a54f051f05784834992c545c542ead38b5e992b8f47 |
File details
Details for the file filediffs-0.1.12-cp37-cp37m-win32.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp37-cp37m-win32.whl
- Upload date:
- Size: 60.2 kB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c61b16f751a65ae40aca3a74e031f1d342ead01da332b316ad07bfaba238dcd |
|
MD5 | d6deb72ec61bce8a557bd573168e8105 |
|
BLAKE2b-256 | 3e565430ff8f6879922615c77e5ff3543632de3ee89491bd8c825dff0f454911 |
File details
Details for the file filediffs-0.1.12-cp37-cp37m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp37-cp37m-manylinux2010_x86_64.whl
- Upload date:
- Size: 167.2 kB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f11ab5797b6350bba386a9ee0cf0522f3555c996c4e83c2d08aa32d23102b8c |
|
MD5 | dda85b6193977f542ab001e10e29e727 |
|
BLAKE2b-256 | 5f40151d729318e7c636dd64892fcc2f8677af3a3418329f70bb11143ecf7ea9 |
File details
Details for the file filediffs-0.1.12-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 123.9 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e27abfd5311c5a196e1d8aa56bdc032c733497c5e8ba461da3354f2b600cb5f |
|
MD5 | 092c01bb8c555202bf0974b96c1c2358 |
|
BLAKE2b-256 | bfdda8db028a2202c4f969a1b05840d0cd80fbcaefb9bd3a30d103340c69801e |
File details
Details for the file filediffs-0.1.12-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 57.7 kB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f752facfab4af049eb1465c071de9265582e43f3a0caa038b37a652389b1c0d |
|
MD5 | 23c06b2b28edf9c015f5b4b4fda20a8e |
|
BLAKE2b-256 | e0bc2ee856f6572798fb364f23d9efa451ec2cdf6e89b4236a65cc13d92168e6 |
File details
Details for the file filediffs-0.1.12-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 62.8 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bffd342e3d7d164ef721219b5e4ee86dd548b8f9f52e26d26d6db10595f6b76 |
|
MD5 | a6ff0e60d8253c4dd0e90cfaca03d1d4 |
|
BLAKE2b-256 | 57d27e8beb4c8accb2113351a9d49cf788f60c08a2d6c69e94bff70a479daef9 |
File details
Details for the file filediffs-0.1.12-cp36-cp36m-win32.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp36-cp36m-win32.whl
- Upload date:
- Size: 60.1 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 810aae9450da6d3066cdca9438f90fe60e28854ed8aafdfcb8a7b8f78cbcb7a1 |
|
MD5 | 2fb1a692dbbcc7476e0efd5a3d6dcd54 |
|
BLAKE2b-256 | c56a5fce6a248ac2f0db892cf98e8954bbf764bf884650f3318b6382a395f191 |
File details
Details for the file filediffs-0.1.12-cp36-cp36m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp36-cp36m-manylinux2010_x86_64.whl
- Upload date:
- Size: 165.4 kB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 946318ce884537425c8bd68cd76443a0a31ac4f8229102e8fbe84461dad11c65 |
|
MD5 | 3d7ed60e4af8a0b48bdc42e857da6e4a |
|
BLAKE2b-256 | 3982b133be68d060c5f9c74f2d8de922319a3ceb7bf24c587567dbd6dc918908 |
File details
Details for the file filediffs-0.1.12-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 123.3 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2756e0444ea6d7637c6ea5aa5615b32f8bc75757f1186144bbea0846d7257f75 |
|
MD5 | a6f95f20bee87accfd578dc8b5124d21 |
|
BLAKE2b-256 | da471da996dca4a9c220cfcf92fe10ff09d32c9ceccdbd327e1658801ffaa9a2 |
File details
Details for the file filediffs-0.1.12-cp36-cp36m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp36-cp36m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 57.6 kB
- Tags: CPython 3.6m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e4504a3fefead52ceaa8c073071f0e29c140c22dc591eb209356d6175e2a6ec |
|
MD5 | 590735047085741a271ffee89c81d037 |
|
BLAKE2b-256 | 1f592933a2577bc6996630923b055e9ac0d6f30ed1b8ad10724133e4f40f9d01 |
File details
Details for the file filediffs-0.1.12-cp35-cp35m-win_amd64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 62.7 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7828c7e51913f1daa5e704bf65ce6fd59e111f849637ca0b2fc4523c24e7a451 |
|
MD5 | a3a587af4ffa4d5b2dff5d8b6f80f320 |
|
BLAKE2b-256 | b71da631de73d4723b1c2efe7495bdad2e175e4024eeebd928135a2e8e9e9e5f |
File details
Details for the file filediffs-0.1.12-cp35-cp35m-win32.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp35-cp35m-win32.whl
- Upload date:
- Size: 60.0 kB
- Tags: CPython 3.5m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0d571b71a77ccb560b7db413e321ba146b87786cc84f1edf184ea2632878a91 |
|
MD5 | 27deefaea20025742d36090cdd2b145b |
|
BLAKE2b-256 | 6d20f2fa45cab446f560b1a6c78dea4926056497754d14c926a2a7a34d639f67 |
File details
Details for the file filediffs-0.1.12-cp35-cp35m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: filediffs-0.1.12-cp35-cp35m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 57.5 kB
- Tags: CPython 3.5m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 099186b5b097a1f71dd832c683a74a010faea01afec88c3193bd5d319e95db54 |
|
MD5 | 69fc5c1ee403070934bce15663967c68 |
|
BLAKE2b-256 | 89505fce8c0ca9da597c3cb600ac13d2b7885b4caed28402d59eddc788fd093a |