Thank you all. I wanted to know if there was already something available but I will build a python script for it. I'm also under Linux and pretty used to that.
Here is an example of input:
lower = \relative f, {
\key f \major
\time 4/4
<f f'>2 r
| <f f'> r
| <c c'>1
| <f f'>2 r
| <d d'>1
| <e e'>2 <c c'>
| <f f'> r
| <bes, bes'>2. <a a'>4
| <g g'>1
| <c c'>
| <f f'>4 r r <bes g'>
| r8 c( g' bes c bes g bes)
| <f a>4 r <f, f'> r
}
F
