Cameron Simpson wrote:
On 09Dec2007 15:17, Stuart Sears <stuart@xxxxxxxxxxx> 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