> $ sed -e ' > > one or more lines > > of script including > > appends and inserts' file1 > file2 Or else: % sed '\ ? one or more lines\ ? of script including\ ? appends an inserts' file1 > file2 But be careful to double-backslash the appends and inserts. Oh, for a good public-domain shell with shell functions!