On 2026-03-06 08:41, Laurent Lyaudet wrote:
sed -i or sed -ni with -e 's/a/b/g' on an empty file
(hence no match, no replace/modification of text at all)
modifies its timestamps...

OK, but that's inherent to an --inplace option, no? Even a write that changes to the same value is still a write.

It sounds like grep would need two options, say --inplace and --no-update-timestamps-inplace-if-equal. But in that case it'd be simpler merely to add the latter option to 'sed'. And to some extent I'm dubious that such a special-purpose option is needed; after all, a shell script is easy to write as-is with sed --inplace followed by cmp -s followed by rm/mv/cp as needed.

it is certain that using fixed strings instead of regexp is way
faster when there is one anchor

Quite possibly, but enough faster to justify the hassle of adding, supporting, and documenting two new options indefinitely? Let's see some numbers.



Reply via email to