If you have a text file with lines
abc
123
def
hij
And you have a directory of files called
abc.txt
tgr.txt
lot.txt
hij.txt
And you want to get the files in the directory that match a line in the text file and move those files in that directory to a sub-directory, what is the best way to do this in bash? The sub-directory, in this example, would have the files:
abc.txt
hij.txt
What I'm thinking is to do something that says: if that string* exists (with a wildcard) in the directory as a filename, move that file to a subdirectory.
I understand that I could potentially use a combination of the find or the grep commands, but I'm honestly stuck as to where to proceed from there. Thanks.