I have a bunch of LilyPond files in the following format:
\score {
\new StaffGroup = "" \with {
instrumentName = \markup { \bold \huge \larger "1." }
}
<<
\new Staff = "celloI" \with { midiInstrument = #"cello" }
\relative c {
\clef bass
\key c \major
\time 3/4
\tuplet 3/2 4 {
c8(\downbow\f b c e g e)
} c'4 | %01
\tuplet 3/2 4 {c,8( b c e f a) } c4 | %02
\tuplet 3/2 4 { g,8( d' f g f d) } b'4 | %03
}
>>
\layout {}
\midi {}
}
How would one extract the \relative c {...} block into a new file, so it would look like this:
\relative c {
\clef bass
\key c \major
\time 3/4
\tuplet 3/2 4 {
c8(\downbow\f b c e g e)
} c'4 | %01
\tuplet 3/2 4 {c,8( b c e f a) } c4 | %02
\tuplet 3/2 4 { g,8( d' f g f d) } b'4 | %03
}
A fix of the indentation is not necessarily needed in this case. Would that be an awk or csplit task? What would it look like?