2021年3月12日星期五

Compare filenames from different directory and then compare to a specific list

What I've tried to far is to use the comm command to list the files that are present in one of the directories and then write them in a txt file.

I want to then compare that txt file output to a default list.

comm -23 <(ll dir1/*war | sort) <(ll dir2/*war |sort) > text1.txt  

The content of text1.txt has this

dir1/apples_version1.5.war dir1/oranges_version1.5.war

The content of list it's being compared to only has the base names

so: oranges.war apples.war

I want to be able to compare the generated list to the default list and get an output that would say

"Both files are there" or "This file is missing", regardless of the filename from the generated list

https://stackoverflow.com/questions/66609738/compare-filenames-from-different-directory-and-then-compare-to-a-specific-list March 13, 2021 at 11:05AM

没有评论:

发表评论