Skip to main content
added 646 characters in body
Source Link
hll
  • 1
  • 1

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.dat in my bash script, then run a case with this script.
  • After this case is done, a new blabla_3300.dat is written in the same directory
  • For the next run, I want to use this last blabla_3300.dat in 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!

Clearifying Note

I should be more clear:

Let's suppose i have blabla_3200.dat, submission.sh, bash.sh in same directory.

I told the program in submission.sh; read data blabla_3200.dat then start running.

To call this submission.sh file to slurm machine, i command sbatch submission.sh in bash.sh

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.

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.dat in my bash script, then run a case with this script.
  • After this case is done, a new blabla_3300.dat is written in the same directory
  • For the next run, I want to use this last blabla_3300.dat in 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!

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.dat in my bash script, then run a case with this script.
  • After this case is done, a new blabla_3300.dat is written in the same directory
  • For the next run, I want to use this last blabla_3300.dat in 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!

Clearifying Note

I should be more clear:

Let's suppose i have blabla_3200.dat, submission.sh, bash.sh in same directory.

I told the program in submission.sh; read data blabla_3200.dat then start running.

To call this submission.sh file to slurm machine, i command sbatch submission.sh in bash.sh

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.

added 11 characters in body
Source Link
terdon
  • 252.2k
  • 69
  • 480
  • 718

In my bash script, iI want to update a string according to new written filenames with .dat format. Here is what i tryI am trying to basicallydo:

  • For example, iI use a file named 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 the same directory
  • For the next run, iI want to use this last blabla_3300.dat in the same bash script.

Therefore, I have to search maximumfor the largest integer in filenames withthe file names .dat format, and with sed command i willthen 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!

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!

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.dat in my bash script, then run a case with this script.
  • After this case is done, a new blabla_3300.dat is written in the same directory
  • For the next run, I want to use this last blabla_3300.dat in 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!

Formatting and tags
Source Link
AdminBee
  • 23.6k
  • 25
  • 55
  • 77

In my bash script, i want to update a string according to new written filenames with .dat.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. Thereforebasically:

  • 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, iI have to search maximum integer in filenames with .dat.dat format, and with sed command i will update my bash script like sed -i 's/3200/max/g' mybash.sh,

sed -i 's/3200/max/g' mybash.sh

then run a new case.

Any help will be appreciated Have a good day!

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!

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!

Source Link
hll
  • 1
  • 1
Loading