I am attempting to use a bash script to create multiple output files from a file I have already created. As well as creating 10 output files I want to alter one piece of text in each of the files i'm creating from the original.
In the original document the starting lines read:
# For a single processor calculation
variable T equal 300 # Simulation temperature
variable salt equal 100.0 # Salt concentration [mM]
# Random number seed for Langevin integrator
variable random equal CPRAND
I want to change text that reads CPRAND to a random number in each file that I am creating.
The current bash script which I am using right now to try and do this is listed below:
for i in {0..10}
do
cat me.sh | sed ’s/CPRAND/$((1 + RANDOM % 1000))/g‘ > “RunFile$(printf “%03d” “$i”).in”
done
I have not had any luck in getting it to work so far for multiple file creation. I appreciate any advice on this.
Thanks!
>(which is meant for quoting). You can also highlight the block and hit the{}button to properly format it. It's difficult to understand how your file is structured with the way your question is currently formatted.“instead of"? Also, what doesI have not had any luckmean? Did you get errors? If so, show them.cathere.sedcan read directly from the source file.