Basically I want to screen for the following files in python using glob.glob module:
log_fasdsaf
log_bifsd72q
log_asfd8
...
but excluding:
log_fdsaf_7832
log_fsafn_fsda
log_dsaf8_8d
...
Naively played around with linux wildcard (eg log_[!_] but apparently not working). How can I use inverse or negative wildcards when pattern matching in a unix/linux shell? seems not helping, and thanks for advices!
You are close. The pattern you are looking for is log_[^_]*
. It says it must have 'log_' followed by zero or more non-underscore characters.