The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 05-24-2007
drl's Avatar
drl drl is offline
Registered User
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 580
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
Reply With Quote