quick Tcl globbing question: excluding lib*.[0-9.]*.dylib

Gustaf Neumann neumann at wu.ac.at
Sat Aug 4 15:34:19 UTC 2018


On 15.06.18 19:39, René J.V. Bertin wrote:
> Is there a way to write a single glob regexp that expands to all lib*.dylib EXCLUDING lib*.[0-9]*.dylib, lib*.[0-9]*.[0-9]*.dylib, etc? I think the excluded list could be obtained by lib*.[0-9.]*.dylib (assuming the dot isn't a wildcard here), is there a better way to get at the list I want than to do 2 globs and then a list exclusion operation?

with tcl 8.6, one can do the following

    set excludePattern {lib*.[0-9]*.dylib}
    set files [glob -tails -dir /opt/local/lib *.dylib]
    set excludedFiles [lmap f $files {if {[regexp $excludePattern $f]} continue; set f}]

The exclude pattern can contains certainly "|" for alternate exclude patterns, etc.
all the best
-gn

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20180804/5583b072/attachment.html>


More information about the macports-dev mailing list