Sample Header Ad - 728x90

Create multiple file from single txt file

0 votes
1 answer
1170 views
I have a single input file that needs to be replicated multiple times with a little change in every file i.e every 30th line in every file is to change. For e.g. My main text file name is D0.txt which I need to replicate multiple numbers time. and in that line 30 is "variable D1 equal 0.0 " Now for the first time when I replicate this file I would like to change that string to " variable D1 equal 1 " and then save the file as D1.txt. Similarly, I would like to create suppose 5 files then I would like to loop it 100 times. so files are saved in a folder as D0.txt D1.txt D2.txt and so on with each of their line 30 as "Diameter = $n" sample text file format is attached below. and desired format of files in folder. enter image description here enter image description here
Asked by Yash54 (19 rep)
Mar 24, 2022, 09:44 AM
Last activity: Mar 24, 2022, 10:35 AM