Normally, looping over the files I use basename to extract the name of the file as a separate variable:
# remove .pdb extension from filename in new variable and print name of the file without it
for pdb in "${storage}"/complex*.pdb ; do
pdb_name=$(basename "$pdb" .pdb)
echo this is "$pdb_name" without its extension!
done
How could I remove several patterns from each file using the same basename expression? For instance, in addition to ".pdb" I would like to omit also "complex", which is always present at the beginning of each file (here I used it as a pattern to recognize file in for LOOP).