I have two directories (cofactors and set) and I need to concatenate the files that match a string on their names. For example, for file names that contains "aloha" and "boo" I would like to do this:
cat cofactors/aloha_12345.txt set/aloha_clean.txt >> aloha_12345.txt
cat cofactors/boo_5675.txt set/boo_7890.txt >> boo_5675.txt
I've been testing with some loops but can't get it right:
for c in set/*.pdb; do echo $c; if awk -F '[/_]' '{print $2}' in cofactors/*.pdb then echo cofactors/*.pdb; done