Dear list,
In cleaning up mountains of OCR'd text, I've found Grep doing something
I don't undesrtand.
The aim is to locate lines ending with certain punctuation marks(-—.)
and spaces. But depending on the order of those punctuation marks, I get
different results. With the full stop listed f
On Thu, Oct 27, 2022 at 03:02:28PM +0100, John Levin via GLLUG wrote:
Dear list,
Dear John,
[...]
Is there something about the order of characters in regex square
brackets? Does the stop have a special meaning when given first?
I think . means any character, does it help to escape it?
On 27/10/2022 15:02, John Levin via GLLUG wrote:
johnl@Hasek:~/github/statutes$ grep ' [-—. ]\{3,\}$' W*/mon*.txt
and every of them are and is hereby obliged to accept, re- ...
'fliqitors autj licences, — Aorb’s -
IPfipficians, -
II — -- — - - -- - - - —
shall be ~ - - —
Is there som
On Thu, Oct 27, 2022 at 03:24:10PM +0100, Henrik Morsing via GLLUG wrote:
> On Thu, Oct 27, 2022 at 03:02:28PM +0100, John Levin via GLLUG wrote:
>> Is there something about the order of characters in regex square
>> brackets? Does the stop have a special meaning when given first?
>
> I think . m
Hi John
In your case it's the hyphen that's special, it is used as range indicator,
e.g. [a-z] means [abcdef...z], unless it's at the end of the bracket expression
To quote from the grep man page
"...to include a literal - place it last."
Although I've always been putting the "-" at the start
John Levin via GLLUG writes:
...
> Is there something about the order of characters in regex square
> brackets? Does the stop have a special meaning when given first?
The place to find the answer is in the regex(7) manpage:
https://manpages.debian.org/testing/manpages/regex.7.en.html
in whi
Dear list,
Thanks very much to all who answered this query; it seems obvious when
one knows the answer, but I was fixated on the stop, and not the dash.
John
On 27/10/2022 19:06, Philip Hands wrote:
John Levin via GLLUG writes:
...
Is there something about the order of characters in regex