2014-10-13 09:49:02 -04:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
# we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun)
|
|
|
|
|
2015-12-10 01:30:09 -05:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
2014-10-13 09:49:02 -04:00
|
|
|
|
2015-12-10 01:30:09 -05:00
|
|
|
open(my $src, '<', shift);
|
|
|
|
open(my $ins, '<', shift);
|
|
|
|
open(my $tmp, '>', 'tmp.delme');
|
2014-10-13 09:49:02 -04:00
|
|
|
|
2015-12-10 01:30:09 -05:00
|
|
|
my $l = 0;
|
|
|
|
while (<$src>) {
|
2014-10-13 09:49:02 -04:00
|
|
|
if ($_ =~ /START_INS/) {
|
2015-12-10 01:30:09 -05:00
|
|
|
print {$tmp} $_;
|
2014-10-13 09:49:02 -04:00
|
|
|
$l = 1;
|
2015-12-10 01:30:09 -05:00
|
|
|
while (<$ins>) {
|
|
|
|
print {$tmp} $_;
|
2014-10-13 09:49:02 -04:00
|
|
|
}
|
2015-12-10 01:30:09 -05:00
|
|
|
close $ins;
|
2014-10-13 09:49:02 -04:00
|
|
|
} elsif ($_ =~ /END_INS/) {
|
2015-12-10 01:30:09 -05:00
|
|
|
print {$tmp} $_;
|
2014-10-13 09:49:02 -04:00
|
|
|
$l = 0;
|
|
|
|
} elsif ($l == 0) {
|
2015-12-10 01:30:09 -05:00
|
|
|
print {$tmp} $_;
|
2014-10-13 09:49:02 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-10 01:30:09 -05:00
|
|
|
close $tmp;
|
|
|
|
close $src;
|
2014-10-13 09:49:02 -04:00
|
|
|
|
|
|
|
# $Source$
|
|
|
|
# $Revision$
|
|
|
|
# $Date$
|