1 |
cnh |
1.1 |
BEGIN{ nsubstotal =0 ; curfile = ""} |
2 |
|
|
|
3 |
|
|
/MITGCM_INSERT_FIGURE_BEGIN/{ |
4 |
|
|
++nsubstotal; |
5 |
|
|
if ( curfile != FILENAME ) { |
6 |
|
|
nsubs=1 |
7 |
|
|
curfile=FILENAME |
8 |
|
|
} else { |
9 |
|
|
++nsubs |
10 |
|
|
}; |
11 |
|
|
print FILENAME " subsitution number " nsubs; |
12 |
|
|
subdir = "figsub/"FILENAME"/sub"nsubs |
13 |
|
|
if ( FILENAME != "-" ) |
14 |
|
|
subdir = "figsub/"FILENAME"/sub"nsubs |
15 |
|
|
else |
16 |
|
|
subdir = "figsub/STDIN/sub"nsubs |
17 |
|
|
; |
18 |
|
|
system("mkdir -p "subdir) |
19 |
|
|
subfile_extract=subdir"/extracted_html"; |
20 |
|
|
subfile_startline=subdir"/startline"; |
21 |
|
|
subfile_endline=subdir"/endline"; |
22 |
|
|
print FNR > subfile_startline |
23 |
|
|
} |
24 |
|
|
|
25 |
|
|
/MITGCM_INSERT_FIGURE_BEGIN/,/MITGCM_INSERT_FIGURE_END/ { |
26 |
|
|
print $0 > subfile_extract |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
/MITGCM_INSERT_FIGURE_END/{ |
30 |
|
|
print FNR > subfile_endline |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
{} |
34 |
|
|
END{} |