Quote:
Originally Posted by
radoulov
Can you use the pattern ^rm $inprogress (at the beginning of the line) as a marker?
Or perhaps its last occurrence?
Do you really need both patterns done .. rm $inprogress?
Why Perl? I suppose the task could be done with a lighter tool (e.g. sed).
The file comes like this, I have no control over it.
And if I have to "prepair" it manually, then I can make the text insert manually too.
But I don't want to.
The last "rm $inprogress" is at the end of the file, so it is the last occurrence.
The text-block needs to be between the last "done" and the last "rm $inprogress", that's a given.
I use Perl, because I need to make many more modifications in other files and I need to start things, stop things, etc.
Perl is perfect for this.
This is one of the many sub-routines in the script.
In fact I need to make 2 text-block insertions in this file and the second one has this problem I described.
If necessary I could call a sed command from within Perl, right ?
But I do not see why it could not be done with Perl.
Okay, I can't, but I am not the brightest Perl programmer around
Not yet.
Now I am thinking about counting the "done"s, printing all lines including the last "done". Then print my text-block and then print the last lines.
Or perhaps read 2 lines, test the 2nd line for "Finished the bulk ftp".
Print all lines until the test is true, print my test-block and print the last lines.
Something should be possible.
E.J.