0

This question already has an answer here:

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?

marked as duplicate by Gilles, cuonglm, Anthon, Stephen Kitt, garethTheRed Jun 10 '16 at 7:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

I haven't used AdaBrowse, but

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

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

  • 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 9 '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 9 '16 at 13:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.