Hi, kthatch.
You did an excellent job of telling us how the output should look.
However, you did not specify how the sections are separated from each other, nor what you consider a comment - a string at the beginning of a line, a string anyplace in a line, etc.
There is a standard utility
nl which knows about sections:
Quote:
-d, --section-delimiter=CC
use CC for separating logical pages
excerpt from man nl
|
There is also
csplit, which can split a file into pieces, based on the occurrence of a regular expression.
Many of the solutions offered are probably adaptable to whatever your file format is, but you may get more on-point suggestions if you are more precise ... cheers, drl