sed isn't that great to work with newlines. if you must use it with newlines use a backslash and an actual newline (not a \n): echo 'helloworld' | sed ' s/hello/hello\ / ' a couple of weeks ago i wrote a xml beautifier in sh. it's possible it's ugly, and fun. -- Mark Smith mark at winksmith.com mark at tux dot org nova-instructor at tux dot org