Created
June 30, 2022 12:18
-
-
Save TheDcoder/886a0bec83295b23fc9e51e3aac422a7 to your computer and use it in GitHub Desktop.
Check if file A is a subset of file B (file B contains contents of file A)
This file contains 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
# Example perl script to check if file A is a subset of file B (i.e. file A has any part of file B) | |
perl -Mautodie=open -e 'undef $/; open $f1, "<", shift; open $f2, "<", shift; exit !!(-1 == index <$f2>, <$f1>)' -- fileA fileB | |
# Credit: tirnanog on Libera.Chat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment