You're going to have to explain how File B relates to File A. I don't want to guess (possibly incorrectly) how adding:
r1 r10 r5
To...
test "r5" test "r1" test "r1" version "10" test "r1" version "11" test "r1" version "12" skip "r1" version "15" test "r4" test "r4" version "10" skip "r4" version "11" test "r3" skip "r3" version "11" test "r10" skip "r10" version "11"
...could result in the addition of these three lines:
test "r5" version "13" ... skip "r3" version "13" ... test "r10" version "13"
Is it a matter of finding the lowest unused "version" number greater than 10? Forget the file handling part... first we need to understand the recipe, or the rules for the change. The insertion issue can't even be addressed until we know how to derive what needs to be inserted, and where.
If this data format has a name, or if you can name its source, that might also help, because things with names or with known sources often have predictable rules.
We might also feel more motivated to help with a question that describes the need more thoroughly, and that shows (with real code) what you've already tried.
Also, if you're wondering why my formatting of your file data looks better than yours, it's because I wrapped it in <code>...</code> tags, per Writeup Formatting Tips.
Dave
In reply to Re: Insert lines in a file
by davido
in thread Insert lines in a file
by PetreAdi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |