Skip to main content
2 of 4
Formatting and tags
AdminBee
  • 23.6k
  • 25
  • 55
  • 77

How to change integer in bash script according to written .dat filenames

In my bash script, i want to update a string according to new written filenames with .dat format. Here is what i try to basically:

  • For example, i use blabla_3200.dat file in my bash script, then run a case with this script.
  • After this case is done, a new blabla_3300.dat is written in same directory
  • For the next run, i want to use this last blabla_3300.dat in same bash script.

Therefore, I have to search maximum integer in filenames with .dat format, and with sed command i will 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!

hll
  • 1
  • 1