Regex sub-expression matching with Find + emacs-regex mode -
i'm trying find compressed log files, , operations on them. can't use ls because thousands of files in directory , bash throws 'argument list long' error. has brought me find, i'm having trouble regex.
here whole find command
find $i -regex '.*logfile_mp[0-9]-gw0[0-9]_2010-09-\(\([7-9]\)|\(1[0-9]\)|\(2[0-3]\)\)-.*' -exec ls {} \;
i need go through several log directories, $i comes bash loop go through directories. right now, i'm trying list files, know have right ones; i'll amend -exec statement once working.
the problem relates parentheses section:
\(\([7-9]\)|\(1[0-9]\)|\(2[0-3]\)\)
i'm trying match range of days (7-23). understand emacs-regex mode, have escape parentheses. rest of regex working because if replace parentheses section number (ex. 7), works fine.
can me create regex sub-expression match 7-23?
thanks.
i think you're on right track, missing \
in front of each of |
:
\([7-9]\|1[0-9]\|2[0-3]\)
Comments
Post a Comment