I am trying to replace some text with the same text pre-pended with some new lines. I thought this would be simple and tried the obvious but it doesn't seem to work: cat myfile | sed -e "s/text/\n\ntext" Any ideas on how to do it?