I am new to coding and I have been looking for a way to write a loop that generates multiple files after changing one aspect of a master file.
I've used some examples to get started and can get the code working for changing and creating 1 file, but not the loop. Here's the code:
for i in 'seq 1 6'; do sed 's/ref.txt/ref${i}.txt/g' CPMIR.as > CPMIR${i}.as
In the end, I would like to change ref.txt in the CPMIR.as file to ref1.txt and output a new CPMIR1.as file, ref2.txt and output the CPMIR2.as, ref3.txt and output the CPMIR3.as,.... all the way to 6.
Thanks for your help!
This might work for you (GNU sed & parallel):
seq 6 | parallel "sed 's/ref\.txt/ref'{}'.txt/g' CPMIR.as >CPMIR{}.as"