I have a script "epsmat_hdf5_merge.py" that merges contents of several files. However, those files are in their individual folders, each named with a number (0001 0002 ...). I am using the most primitive method to identify the files in the folders:
epsmat_hdf5_merge.py q0001/eps0mat.h5 q0002/eps0mat.h5 q0003/eps0mat.h5 0004/eps0mat.h5 q0005/eps0mat.h5 q0006/eps0mat.h5 q0007/eps0mat.h5 q0008/eps0mat.h5 q0009/eps0mat.h5 q0010/eps0mat.h5
Note here that the command is "epsmat_hdf5_merge.py" followed by all the .h5 files in their respective folders.
I cannot use a simple seq loop because
for i in seq`1 999`
do
epsmat_hdf5_merge.py q$i/eps0mat.h5
will simply do the following:
epsmat_hdf5_merge.py q0001/eps0mat.h5
epsmat_hdf5_merge.py q0002/eps0mat.h5
epsmat_hdf5_merge.py q0003/eps0mat.h5
...
which is only one file followed by the .py script. The merge script hence cannot merge anything at any step.
Any idea how to handle this?
Endnote:
Also, if we change the total number of folders (999) now to a variable (var), how will the syntax be like considering bracket expansion has trouble managing the $var?