So here is the deal. I have a massive text file full of random information. I want to extract certain paragraphs and output them into a separate text file.
Here is a sample of the initial text file:
Quote:
Reading 67: The Theory of Active Portfolio Management
The candidate should be able to:
a. justify active portfolio management when security markets are nearly efficient;
b. discuss the steps and the approach of the Treynor–Black model for security
selection;
c. describe how an analyst’s accuracy in forecasting alphas can be measured and
how estimates of forecasting can be incorporated into the Treynor–Black
approach.
www.example.dot/toolkit—Your online preparation resource
Study Session 18
Reading 68: The Portfolio Management Process and the Investment
Policy Statement
The candidate should be able to:
a. explain the importance of the portfolio perspective;
b. describe the steps of the portfolio management process and the components of
those steps;
c. define investment objectives and constraints and explain and distinguish among
the types of investment objectives and constraints;
d. discuss the role of the investment policy statement in the portfolio management
process and explain the elements of an investment policy statement;
e. explain how capital market expectations and the investment policy statement
help influence the strategic asset allocation decision, and discuss how investors’
investment time horizon may influence their strategic asset allocation;
f. contrast the types of investment time horizons, determine the time horizon for a
particular investor, and evaluate the effects of this time horizon on portfolio
choice;
g. justify ethical conduct as a requirement for managing investment portfolios.
www.example.dot/toolkit—Your online preparation resource
|
Here is what I want to see in the output file:
Quote:
Quote:
Reading 67: The Theory of Active Portfolio Management
The candidate should be able to:
a. justify active portfolio management when security markets are nearly efficient;
b. discuss the steps and the approach of the Treynor–Black model for security
selection;
c. describe how an analyst’s accuracy in forecasting alphas can be measured and
how estimates of forecasting can be incorporated into the Treynor–Black
approach.
Reading 68: The Portfolio Management Process and the Investment
Policy Statement
The candidate should be able to:
a. explain the importance of the portfolio perspective;
b. describe the steps of the portfolio management process and the components of
those steps;
c. define investment objectives and constraints and explain and distinguish among
the types of investment objectives and constraints;
d. discuss the role of the investment policy statement in the portfolio management
process and explain the elements of an investment policy statement;
e. explain how capital market expectations and the investment policy statement
help influence the strategic asset allocation decision, and discuss how investors’
investment time horizon may influence their strategic asset allocation;
f. contrast the types of investment time horizons, determine the time horizon for a
particular investor, and evaluate the effects of this time horizon on portfolio
choice;
g. justify ethical conduct as a requirement for managing investment portfolios.
|
|
I can match the beginning of each paragraph using the regex 'Reading [0-9]*:'. This regex will return the first line of the paragraph, but I also need to select the remaining bullets until the end of the bullets. I can match the end of the bullets with the regex '^$'.
If I could find a way to grep and everything between 'Reading [0-9]:' and '^$' then output that to a file, this would fix my problem. Please help. Thanks