On 2026-03-05 07:10, Laurent Lyaudet wrote:

The first one is an --inplace option:
The key feature being that the greped file must not be modified at all,
if grep kept all the lines, which means that timestamps of the file
should be unaffected.

That implementation should use cmp -s, instead of calling wc twice, since it's possible for the output of grep to differ from its input even though both contain the same number of newlines.

My initial reaction is that there's little need for "grep --inplace EXPR FILE", as one can already use "sed -ni /EXPR/p file" to get that effect.


The second one is to extend the --fixed-strings option
with the possibility to ask that the fixed string is searched
at the start or end of the line.

We already have "grep -F --line-regexp 'STRING'", which asks that the fixed string matches both start and end. So it sounds like you're asking for new options (say, --start-line-regexp and --end-line-regexp) which anchor only the start and end, and are equivalent to "grep '^S'" and "grep 'S$'" where S is the escaped version of STRING.

It shouldn't be too hard to add that, if there's a real need and if there's a significant performance boost. (Have you measured the performance?)



Reply via email to