Robert L Cochran wrote:
Cameron Simpson wrote:
> On 09Dec2007 15:17, Stuart Sears <stuart(a)sjsears.com> wrote:
> | 1. which (uncommented) lines are in /etc/ldap.conf at the moment?
> | egrep -v '^($|#)' /etc/ldap.conf
>
> OT - grep curiosity...
> You can embed a "$" inside an alternation?
>
> Personally, I've always used:
>
> grep '^[^#]'
>
> for this task.
>
> Cheers,
This:
egrep -v '^($|#)' /etc/ldap.conf
matches any line which is not blank and does not have an octothorpe in
it. It is not negating a character class which is what you put inside
brackets [ ]. It is negating the start of a line or the octothorpe
'#'. That leading caret ^ negates each alternative within the
parentheses.
Bob Cochran
No, I'm wrong -- I put my foot in my mouth here. I should have checked
on the -v option for egrep first. It inverts the sense of the match. And
the '$' anchors the end of a line, not the start. I need to give this
one more thought....
Bob