On Tue, 1 Jan 2019 18:09:14 +0100, Hans-Bernhard Bröker
<
bro...@physik.rwth-aachen.de> wrote:
>Am 01.01.2019 um 04:17 schrieb Paul S Person:
>> but what I want is to catch both cases, that is, to show "Lines: 2".
>
>That fails because wgrep is really more like a traditional 'fgrep' than
>'grep'. It doesn't have regular expressions, instead it supports
>searching for multiple literal strings (but that can hardly be used
>directly from the command line, thanks to the way MS command line shells
>work).
That explains a few things.
>The -e option helps, once you've got past an undocumented feature: if
>you use -e for one search string, you have to use it for all of them.
That explains why, when I tried it, it did not work.
>This works, sort of:
>
> wgrep -c -e \^^\[ -e \^^\] input.diff
>
>But there's another catch. The \^ pattern for matching begin-of-line
>apparently fails work on the first line of a file. For most 'diff'
>files that would do, but some may not have the leading line reporting
>how diff was invoked, so YMMV.
The OW diff (in the repository) starts with a number on the first
line, presumably giving the location in the file (thus "4c4" /might/
mean "line 4 changed into line 4", but then, it might not, who can
say?) so I don't expect that to be a problem. But I will keep it in
mind as I start work on c_readme with WHELP.
>Maybe you really should consider switching to a more useful
>implementation of grep --- even NT's "findstr" might qualify.
Although this is currently for use only on my local computer, it may
well grow into a regression test should our wgml ever reach
completion. So I am using the diff and the wgrep which are found in
the repository, in the hope that they will work on all supported
hosts.