On 20-05-2011 17:39:22 +0200, Jeroen Roovers wrote: > I've looked into sed's internal solutions to no avail, but something > like -i[SUFFIX] might help, since it gives you a backup file to compare > with the file that's being streamed. > > The idea is to pass the result to > | diff -u $file $file[SUFFIX] > to figure out what was changed, and what sed script changed it.
I like your idea a lot. I had to do a similar thing once in eapify, and back then I came up with the following hack: sed -e "<pattern>" "${file}" | diff "${file}" - followed by the actual sed -i -e ... This way I didn't need to write an intermediate file. -- Fabian Groffen Gentoo on a different level