>Can you use a regexp like: >s/\(known_part\)\(.*\)\(change_part\)/\1\2replace_part/ Unless I misunderstand that, I'd say no. The actual file might look this: /begin file foo bar{ biz service-one baz service-two } --many more of that-- # comment fiz bir{ aaa service-one bbb service-two } /end file So only after the "# comment", I want to then start replacing. I am just trying to replace a very ugly long set of commands piped into each other that I am using now. Thanks! jlc