Hello,

I coded in bash two variants of grep suited for my needs.
Maybe you would think that it could be interesting options
to add to GNU grep.

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.
Here is the Bash code for it:
https://github.com/LLyaudet/DevOrSysAdminScripts/blob/842531d49ad9230e26edc5123f7b3795a2640470/build_and_checks_dependencies/lines_filters.libr.sh#L117-L130

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.
Here is the Bash code for it:
https://github.com/LLyaudet/DevOrSysAdminScripts/blob/842531d49ad9230e26edc5123f7b3795a2640470/build_and_checks_dependencies/lines_filters.libr.sh#L132-L221
Once coded in GNU grep, it would be simpler in terms of efficiency and
code than using regexp and escaping.

Maybe the second one can be thought better to handle many fixed
strings instead of one.
I'm open to discuss this, and I hope you may consider at least some of
these features useful.

Best regards,
     Laurent Lyaudet



Reply via email to