Bash - extract an indented code block into new file
2
votes
1
answer
550
views
I have a bunch of [LilyPond](http://www.lilypond.org) files in the following format:
\score {
\new StaffGroup = "" \with {
instrumentName = \markup { \bold \huge \larger "1." }
}
>
\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?
Asked by nath
(6094 rep)
Dec 1, 2019, 08:24 PM
Last activity: Dec 2, 2019, 01:13 AM
Last activity: Dec 2, 2019, 01:13 AM