
snowpl10
New User
Jul 22, 2016, 10:23 AM
Post #1 of 3
(1813 views)
|
how to replace parameters in a file
|
Can't Post
|
|
Hi all, I have a file df.txt in the following. In each line of df.txt, there are four place holders x1 ~ x4. Then I have another file param.txt, while each row has four values. I want to write a script, while for each loop, the first row in the param.txt file will replace x1~ x4 in all rows in the df.txt file. So if there are n rows in the param.txt file, there will be n df.txt files. After each loop, the filled df.txt file will be in a specific directory. How to realize this through a script? Thanks. df.txt 1 5.5 6.2 3.3 5.6 x1 x2 x3 x4 6.7 8.0 2 6.7 6.1 3.5 5.5 x1 x2 x3 x4 6.6 8.9 3 6.4 6.2 3.4 5.5 x1 x2 x3 x4 6.7 9.1 4 6.0 5.5 3.6 5.7 x1 x2 x3 x4 6.4 9.0 param.txt 2.3 2.6 7.8 9.1 2.1 2.5 7.5 9.8 3.4 3.3 7.6 8.8
|