#!/bin/bash sed ' s/\(\\new\s\+Voice[^{]*\|\\addQuote\s[^{]*\){/\1\\transpose '"$1"' {/ '