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): ---begin example--- Number: 001 Title: Advocacy Verse: Have you heard of Debian, The OS that ran and ran? Chorus: Just download it free To one of your CDs. Verse: You should try it; You need not buy it. Number: 005 Title: Another Song ---end example--- The original starts at a Number: line like the example, continues through n lyric sets, and ends just before another Number: line. Lyrics may or not have a chorus. 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) (More/fewer blank lines in output are okay). The end of the Verse chunks are either a blank line or a Number: line. Thanks for reading this far; last is an example of the output I am hoping for. ---begin example--- Number: 001 Title: Advocacy \begin_layout Verse Have you heard of Debian, \begin_inset Newline newline \end_inset The OS that ran and ran? \end_layout \begin_layout Chorus Just download it free \begin_inset Newline newline \end_inset To one of your CDs. \end_layout \begin_layout Verse You should try it; \begin_inset Newline newline \end_inset You need not buy it. \end_layout Number: 005 Title: Another Song ---end example---
signature.asc
Description: Digital signature