[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sed: adding lines before/after/inside line groups



On Qua, 13 Jan 2010, green wrote:
My head is about to burst from trying to comprehend sed usage.  Perhaps some
kind individual(s) will help me lest my mental capacity by surpassed.

I have a file that looks like this (please pardon the bad, fake lyrics):
[snip] example

I want to convert these to a LyX format that I have established.

The Number: and Title: lines are easy enough to convert; only the Verse: and
Chorus: chunks (which may be 8 lines) are a problem.  I need those chunks to
have:
- 1 line added before (different for verse/chorus)
- 2 lines added between lines
- 1 line added after (same for verse/chorus)

It may be possible to do this in sed alone, but a more complete scripting language, such as perl, python, ruby, etc. will probably make the job easier, since you'll not be limited to processing each line individually.

--
No man in the world has more courage than the man who can stop after
eating one peanut.
		-- Channing Pollock

Eduardo M KALINOWSKI
eduardo@kalinowski.com.br


Reply to: