[Mailman-Users] compare lists setup

Mark Sapiro mark at msapiro.net
Wed Mar 22 19:13:17 EDT 2017


On 03/22/2017 03:39 PM, Julian H. Stacey wrote:
> 
>  cd /usr/local/mailman/lists
>  config_list -o - bg | egrep -v '^[[:space:]]*#|^$'    # OK, but not ideal
>  config_list -o - bg | egrep -v '^[[:space:]]*#|$'     # Empty.

Because '^[[:space:]]*#|$' matches '^[[:space:]]*#' or '$' i.e.
everything with an end of line


>  config_list -o - bg | egrep -v '^[[:space:]]*[#$]'    # Blank lines remain.

Because [#$] is a character class matching literally '3' or '$' not end
of line.


>  config_list -o - bg | egrep -v '^[[:space:]]*[#$]|^$' # OK
>  config_list -o - bg | egrep -v '^[[:space:]]{0,}[#$]' # Blank lines remain.
>

As above.

> Does some other Unix have a better worded or more verbose RE definition,


You don't need to be concerned about leading whitespace because
config_list -o doesn't write comments with lkeading whitespace.

config_list -o - bg | egrep -v '^(#|$)'

which matches and ignores any line that starts with # or is empty. This
is similar to your '^[[:space:]]*#|^$' example without the unneeded
[[:space:]]* except it says 'beginning of the line followed by either #
or end of line' instead of 'beginning of line followed by # or begining
of line followed by end of line'

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan


More information about the Mailman-Users mailing list