I have a file strings.txt with a list of strings:
GCA_001677475.1
GCA_003410275.1
GCA_002310615.1
GCA_000007405.1
GCA_000219515.3
And I have many files in a directory with names like:
GCA_000005845.2_ASM584v2_protein.faa
GCA_000006925.2_ASM692v2_protein.faa
GCA_000007405.1_ASM740v1_protein.faa
GCA_000007445.1_ASM744v1_protein.faa
GCA_000008865.2_ASM886v2_protein.faa
GCA_000009565.2_ASM956v1_protein.faa
I need to move only those files whose names start with a pattern from strings.txt. So far I've tried using xargs with mv:
cat strings.txt | xargs -I % mv %*faa ./Data
But mv doesn't see %*faa as a regex and tries to find files with this exact name (and of course it can't find any). I've also tried using ls but it works the same way:
cat strings.txt | xargs -I {} ls {}*faa
So how can I do that?
cat strings.txt | xargs -I {} ls {}*faanor this onecat strings.txt | xargs -I % mv %*faa ./Datadidn't work.