A file system with deduplication would do this on blocks of data. Such as the zfs dedup, but things like that can be memory/computational hits as it essentially needs to build a database to map the "duplicate" data blocks to the one in disk and may not be worth the extra RAM used etc...