I've got a complicated challange. I'm not very practical of linux and script but I need to solve a problem. I've got a file list.txt containing two column in the first there is the name of the objects and in the second there is variable. Now I want used this information to copy a specific files in specif directories. For example:
The working directory is this:
This is the file
121p1_004_______________ GCP 13gs1_001_______________ SAS 1am42_003_______________ GNP 1bmq1_003_______________ MNO ecc...
In the working directory show below there are a lot of directory and the name of some of this directories is correleted to the first 5 characters of name of the object present in the first column of the file "list.txt". For example: 1j4r3, 1t403,
In each of this directory there are a lot of files. I need, for each line of the file "list.txt" use the first column to select the direcoty, enter on this directory, select the file of interest and copy this in another direcory
(/home/tommaso/Desktop/pdb_files). The file of interest is called like the variable reported in the second column of the file "list.txt". Example:
directory: /nfs/BioGPSDB/pockets/MD/fixed/1/121p1 File of interest: "GCP_?.pdb" where "?" is one character (letter or number) Final directory: /home/tommaso/Desktop/pdb_files
So in the end in the directory
/home/tommaso/Desktop/pdb_files I must have all files like this:
GCP_?.pdb, SAS_?.pdb, GNP_?.pdb, MNO_?.pdb ecc..
So the script should read the
list.txt file and for each directory named as the first 5 characters in each row of the first column it should copy the file named as the variable in the second column with extension
"_?.pdb" in a final directory where all files will be present.
I hope to have been clear enough and I hope to find someone willing to help me because I don’t know where to start!