Я написал маленькое ПО C в awk
. Это близко к тому, что вы хотели?
awk '
/^[0-9]/ { print "skipping " $0; next; }
/step / { fn = sprintf("%s.%s", $1, $2); print "assigned fn = ", fn; }
/^ *[A-Z]/ { print $0 >> fn; print "sent ", $0, " to ", fn; }
' infile
Вывод:
skipping 6
assigned fn = step.1
sent C 9.0000000 8.3380808 9.0000001 to step.1
sent C 9.0000000 9.6619194 8.9999999 to step.1
sent H 8.0768455 7.7678700 9.0000001 to step.1
sent H 9.9231545 10.2321301 9.0000001 to step.1
sent H 8.0768455 10.2321301 9.0000001 to step.1
sent H 9.9231545 7.7678700 9.0000001 to step.1
skipping 6
assigned fn = step.2
sent C 9.00000000 8.33808080 9.00000010 to step.2
sent C 9.00000000 9.66191940 8.99999990 to step.2
sent H 8.07684550 7.76787000 9.00000010 to step.2
sent H 9.90912982 10.23213008 8.83969637 to step.2
sent H 8.09087028 10.23213012 9.16030383 to step.2
sent H 9.92315450 7.76787000 9.00000010 to step.2
skipping 6
assigned fn = step.3
sent C 9.00000000 8.33808080 9.00000010 to step.3
sent C 9.00000000 9.66191940 8.99999990 to step.3
sent H 8.07684550 7.76787000 9.00000010 to step.3
sent H 9.86748170 10.23213006 8.68426301 to step.3
sent H 8.13251850 10.23213014 9.31573717 to step.3
sent H 9.92315450 7.76787000 9.00000010 to step.3
Файлы результатов:
$: cat step.1
C 9.0000000 8.3380808 9.0000001
C 9.0000000 9.6619194 8.9999999
H 8.0768455 7.7678700 9.0000001
H 9.9231545 10.2321301 9.0000001
H 8.0768455 10.2321301 9.0000001
H 9.9231545 7.7678700 9.0000001
$: cat step.2
C 9.00000000 8.33808080 9.00000010
C 9.00000000 9.66191940 8.99999990
H 8.07684550 7.76787000 9.00000010
H 9.90912982 10.23213008 8.83969637
H 8.09087028 10.23213012 9.16030383
H 9.92315450 7.76787000 9.00000010
$: cat step.3
C 9.00000000 8.33808080 9.00000010
C 9.00000000 9.66191940 8.99999990
H 8.07684550 7.76787000 9.00000010
H 9.86748170 10.23213006 8.68426301
H 8.13251850 10.23213014 9.31573717
H 9.92315450 7.76787000 9.00000010
Обратите внимание, что в вашем примере не было пробелов в первом разделе, но есть в последующих.
Отрегулируйте по мере необходимости, надеюсь, это поможет.