First of all youryou are getting an error because you are missing a ;then
in the third line 3 of your code and then a fi
to close the if
. It should be:
for i in *.vcf
do if grep -q $i 1.txt; then
cp *$out* /temp/hgig/fi1d18/TRG45/snp/snp/TRG/pre/
fi
done
And I guess the one-liner below achieves what you are trying to do:
while IFS= catread file-list.txt | while readr line; do mv $line*"$line"*.vcf some-directory; done < file-list.txt