I have a List.txt with the list of thousand of folders and files of them which looks similar to this
cat List.txt
folder1, filestar
folder2, filefish
folder3, filedoll
folder4, filegoose
and this goes on. And I have filenames in separated directories (names of directories: sample1, sample2, sample3 …) which match the filenames on a List.txt. So the question is how to find the matching filenames with the files of folders in a list? And I found the command which lists only files inside of directories.
ls -lA sample* | awk -F':[0-9]* ' '/:/{print $2}' | awk 'BEGIN { ORS = " " } { print }'
I just don't know how to print only the files which match with the filenames of List.txt