I'm trying to get sed to update a bunch of my source files with a common comment and maintain the indent. I can get the line inserted above the regexp match but it has no indent. So I'm trying to capture the amount of indent using backreferences but it's not working. Any ideas? Here's what I have now: sed /^\( *\)put comment above this line/i\\1### My comment Currently the regexp works and the line is inserted above "put comment above this line", but the back reference "\1" doesn't get evaluated. Eric