repo.or.cz
/
tomsfastmath.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Merge pull request #26 from aewag/develop
[tomsfastmath.git]
/
filter.pl
blob
6313f754955eb08f5c6e39a8772ceda629908d1e
1
#!/usr/bin/perl
2
#
3
# we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun)
4
#
5
# SPDX-License-Identifier: Unlicense
6
7
$dst
=
shift
;
8
$ins
=
shift
;
9
10
open
(
SRC
,
"<
$dst
"
);
11
open
(
INS
,
"<
$ins
"
);
12
open
(
TMP
,
">tmp.delme"
);
13
14
$l
=
0
;
15
while
(<
SRC
>) {
16
if
(
$_
=~
/START_INS/
) {
17
print
TMP
$_
;
18
$l
=
1
;
19
while
(<
INS
>) {
20
print
TMP
$_
;
21
}
22
close
INS
;
23
}
elsif
(
$_
=~
/END_INS/
) {
24
print
TMP
$_
;
25
$l
=
0
;
26
}
elsif
(
$l
==
0
) {
27
print
TMP
$_
;
28
}
29
}
30
31
close
TMP
;
32
close
SRC
;