linux - How to determine if the content of one file is included in the content of another file -


first, apologies perhaps rather stupid question doesn't quite belong here.

here's problem: have 2 large text files containing lot of file names, let's call them , b, , want determine if subset of b, disregarding order, i.e. each file name in a, find if file name in b, otherwise not subset.

i know how preprocess files (to remove file name itself, removing different capitalization), i'm left wonder if there simple way perform task shell command.

diff doesn't work, right? if 'sort' 2 files first, @ least files present in both in same order, since proper subset of b, diff tell me every line different.

again, apologies if question doesn't belong here, , in end, if there no easy way write small program job, since i'm trying better handle on shell commands, thought i'd ask here first.

do this:

cat b | sort -u | wc cat b | sort -u | wc 

if same result, subset of b.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -