4 # A record is an IE heading
5 RS =
"-- =+\n-- IE: [A-Z][A-Za-z0-9-]+"
12 print "Usage: " ARGV[0] " file.asn"
13 print "Splits file.asn generated by txt2asn into one file per module"
17 gsub(/.asn$
/, "", file_prefix
)
23 # Search for the start of a module definition in every field (= line) of the IE
24 for (i =
1; i
<=
NF; i
++) {
25 if ($i ~
/[[A
-Z
][A
-Za
-z0
-9-]+ DEFINITIONS AUTOMATIC TAGS
::=
/) {
26 split($i, module_name
, " ")
27 outfile = file_prefix
"-" module_name
[1] ".asn"
31 # See below about heading
33 print heading
$0 > outfile
36 # RT is the record terminator i.e., the string that matched RS
37 # It actually is the heading of the next record, so store it
38 # to be printed with the next record.