0

I have to use the AdaBrowse Html generator to create a bunch of formatted files. Unfortunately, all of these files contain headers before each function or procedure that follow no consistent form of formatting.

-- Example 1 - new
--##################################################
-- Name: Example
-- Version: 1.0
-- Description: Shows Example
-- a 12-bit field containing the an example.
-- Inputs: AN_Example.
-- Outputs: None
-- Return Values: Examples
-- Callers:
--
-- Callees:
--
----------------------------------------------------------

-- Example 2 - new
--##################################################
-- Name: Example
-- Version: 1.0
-- Description: 
-- Shows More Examples
-- in a 12-bit field containing the an example.
-- 
-- Inputs: AN_Example.
-- Outputs: None
-- Return Values: Examples
-- Callers:
--
-- Callees:
--
----------------------------------------------------------

AdaBrowse has a very good formatting option using sed but I can't get it to extract only the lines from "-- Description:" to (and not including) "-- Inputs:"

The closest Iv'e gotten was with the command:

sed -r 's/.*(Description:[^Inputs:]*).*/\1/g

But it grabs everything. How can I extract the said lines?

Erathiel
  • 1,575

1 Answers1

1

I haven't used AdaBrowse, but

sed '/-- Description:/,/-- Inputs:/!d;/-- Inputs:/d'

works with your example, so you could give it a try.

adonis
  • 1,724
  • 1
    In general, the pattern '/START/,/END/ {PROGRAM}' executes PROGRAM on the part of the file between the string START and the next occurrence of the string END. – WAF Jun 09 '16 at 13:08
  • Thanks! Your example works on a stand alone .ads file but if I use it with AdaBrowse I'm still getting everything. Maybe it's something going on with the utility itself. I'm not sure. – Arban Nichols Jun 09 '16 at 13:42