I'm trying to copy directories of data sets that pertain to the a certain case but the data sets are currently stored in different directories and with different (non consecutive) numbered file.
e.g. I have a case file case_directory/006
and I want to copy and create case_directory/006/MRS
from where that case's MRS
directory is currently stored in data_directory/150/MRS
. The next case would be case_directory/010
and for that I would want to copy data_directory/155/MRS
- just to illustrate there is really no relation between the numbering systems. I have about 120 of such case directories so would be great to automate the copying process from the matching data directory! :-/
Can I automate this using the for
and cat
commands and text files containing lists where the matching numbers are on the same row in each text file? can you use more than 1 variable with for
or do I need to use a more complicated script?
while
/read
loop:while read num1 num2; do cp -R case_directory/$num1/MRS data_directory/$num2; done < file_with_matching_nums
instead of afor
loop. – muru Sep 09 '15 at 21:23