in reply to Re^2: adding lines at specific addresses
in thread adding lines at specific addresses
Use more than one hash if that makes things easier (but often, a single hash will do).
As for working out how to construct the output file, it would be better, if possible, for the changes to be made and output produced as you're reading the input. For example, if you somehow know that you need to insert a "(LIG O 51 ...)" line and you input a line that has "(LABEL O 52)", do you have enough information at this point to output the line(s) that should precede "(LABEL O 52)" ?
If you need to read the whole input before resolving that sort of problem, that's okay -- but again, it may be better to hold the input data in a suitable structure (AoH or HoA or somesuch) to reduce the risk of scrambling it beyond recognition.
You showed us an "easy" example in the OP, but you haven't given us a clear example of a "hard" case -- what it looks like on input, and what you'd like it to look like on output -- maybe I'm missing something, but this part isn't clear to me based on what you've said so far.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: adding lines at specific addresses
by pindar (Initiate) on Oct 11, 2005 at 10:47 UTC | |
by graff (Chancellor) on Oct 11, 2005 at 12:37 UTC | |
by pindar (Initiate) on Oct 12, 2005 at 06:29 UTC | |
by graff (Chancellor) on Oct 12, 2005 at 06:56 UTC | |
by pindar (Initiate) on Oct 13, 2005 at 11:19 UTC |