On Sat, May 17, 2008 at 6:48 AM, Josh Paetzel <josh at tcbug.org> wrote: > Most likely you aren't matching the whitespace because it isn't 5 or more > literal spaces. I'd substitute [[:space:]] for it and maybe wrap the > expression in '' to eliminate some of the backslashes giving you... Sorry I forgot to mention the above space is actually a command sequence for tab (Ctrl-V + Ctrl-I). > sed -e '/^([[:space:]]*)put comment above this line/i\\1### My comment' > > It's also worth noting your sed may take a flag to interpret EREs and things > like [[:space:]], I don't have gnu sed handy here to test. Thanks for the suggestion. I'll give it a try when I get a chance. Josh, sorry for the double post, I forgot to reply-all.