In my bash script, I want to update a string according to new written filenames with
.dat format. Here is what I am trying to do:
- For example, I use a file named
blabla_3200.datin my bash script, then run a case with this script.
- After this case is done, a new
blabla_3300.datis written in the same directory
- For the next run, I want to use this last
blabla_3300.datin the same bash script.
Therefore, I have to search for the largest integer in the file names
.dat, and then use
sed to update my bash script like:
sed -i 's/3200/max/g' mybash.sh
then run a new case.
Any help will be appreciated Have a good day!
I should be more clear:
Let's suppose i have
bash.sh in same directory.
I told the program in
read data blabla_3200.dat then start running.
To call this
submission.sh file to slurm machine, i command
sbatch submission.sh in
Then end the end of run, program writes output file
blabla_4500.dat in same directory(it is unknown what is going to write, it might blabla_8254.dat for example).
What i want this; the code in bash.sh should update read data command in submission.sh after each new output came. Now in submission.sh,
read data blabla_4500.dat shoud be commanded.