I am working on a linux cluster. I have a list of files that i need to find.
Sample10
Sample22
These files have another serial number based naming convention. A tab separated file key.tsv
contains both names listed on a single row.
Sample10 Serial102
Sample22 Serial120
I need to find the file by one name and link the file to another directory using its other ("Serial") name. This is my attempt.
for i in "Sample10" "Sample22";
do
if [[ `find /directory/ -name $i*.fastq`]]
then
R1=$(find /directory/ -name $i*.fastq);
ln -s $R1 /output/directory/"$i".fastq;
else
echo "File existence failed"
fi
done
This works to find the file of interest from the list and link it but i am stumped as to how rename them based on the entries in the key.