I am a newbie and wasted a lot of time on this so any help is greatly appreciated. Suppose I have a simple Mathematica script file named "a.m" which contains the parameter 'a' with no assigned value:
Solve[x^2+5^a==0,x]>>a.out
What I would like to do is to create multiple script files by varying the value 'a' say from 1 to 10 and name each file by the corresponding value of 'a' such as 1.m, 2.m etc.. For this, I tried to use the 'sed' command in a for loop in the following way:
for ((i=1; i<=10; i++)); do sed 's/a/i/' <a.m >i.m; done
so that for each fixed value of i it would replace 'a' by the numerical value and create a new file with the name 'i.m'. However above line creates a single script file named i.m with 'a' replaced by 'i'. Any suggestions ?
Aucun commentaire:
Enregistrer un commentaire