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!