Start New Discussion within our Software Development Community

consider a list of files in a particular directory(LIST A)

58623208 Sep 14 20:08 blbn_blfbe_drv
57904920 Sep 14 19:54 blbn_cycmn
55814208 Sep 14 06:02 clsa_Upd
38912000 Sep 14 19:12 cs_chgpp

and in another directory (LIST B)
58623208 Sep 14 20:08 blbn_blfbe_drv
57904920 Sep 14 19:54 blbn_cycmn
55814208 Sep 14 06:02 clsa_Upd
38912000 Sep 14 19:12 cs_chgpp
41107456 Sep 14 19:17 csmRFbe
39403520 Sep 14 19:09 csmUAddAct
39235584 Sep 14 19:20 csmUAddSub

where list A is a subset of list B

Now I want to search for files the files which are present in LIST A in LIST B
and compare each attribute(size,month,date,time,name) and print out the filename which
is not found in LIST B or if any attribute(size,month,date,time,name) is mismatching.

or
Display any message like all the files are found and all atributes are matching only if
all the files are found in LIST B and all its attributes are matching.

I donno what would be nice way to do this(may be i need awk to do this, ro some while loop)

Please suggest.

There is a huge amount of context missing here. For instance, are the lists always arranged such that the subset list (LIST A) is the first N items to appear in the full list (LIST B)?

Without any insight I'd suggest that the only thing you can base the difference on is the file name (all other fields are subject to change). This lends itself to some sort of structure based on the file name with elements of the structure being the attributes of the file. Using some scripting language (perl, ruby) to facilitate that you could easily sort the two lists and compare differences in sorted order (according to file name).

I'd certainly try to avoid to the epic shell one-liner - you'd only be inviting maintenance nightmares.

What have you tried so far and why is it not currently working?

This article has been dead for over six months. Start a new discussion instead.