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