Hi guys,
I have 1000s of MAGs fasta files in a single folder. So I wanted to move only a few groups of MAGs into a separate folder. So I have listed all the files (e.g., GCA_003221885.fa
) one by one that I need to move in a txt file called HQ_MAGS.txt
which is in the directory /home/venkat/Gemmatimonadota
So, if I wanted to move the listed files into this directory /home/venkat/Gemmatimonadota/HQ
How I do that using bash?
Many thanks
Venkat
While it is tempting to ask for ready solutions it is more fun to search/experiment. This is the only way you will learn. Since we can't see your data/file/folders (and the question is not clear) you may not get great answers.
It sounds like you have a list of files you want to selectively move into a folder. So walk through the file in a
for
loop and then simplymv that_file /home/venkat/Gemmatimonadota/HQ
. I will leave you to find the specific answer.thanks for your reply i did try using loop , but unfortunately it didn work out. here is the command that i used.
for file in cat HQ_MAGS.txt; do mv "$file" /home/venkat/Gemmatimonadota/HQ; done
clarity on my question:
I have bunch of fasta files in the HQ_MAGS.txt see below
GCA_003221885.fa GCF_014202995.fa GCA_029262115.fa GCA_027593165.fa GCA_022571515.fa GCA_016873995.fa GCF_000695095.fa GCA_028278645.fa
any help would be much appreciated
You appear to be missing back-ticks around the
cat
command. Try the command above. If all command lines (that will be simply printed to screen) look right, then remove the wordecho
to actually move the files.Note: This will only work if you have one file name per line in MAGs file and the files to be moved are in the directory where you are running this from.
Please use Google to understand how to use tags. Don't copy paste the title into the tags field, use keywords. I've fixed it for you this time.