I am trying to create a find command to find the files that git create when there is a conflicting rebase/merge.
.//Tools/tri_tri_intersect.h
.//Tools/tri_tri_intersect.cpp
.//Collisions/PBD/FiltersUtils_BACKUP_450361.cpp
.//Collisions/PBD/FiltersUtils_BASE_450361.cpp
.//Collisions/PBD/FiltersUtils_LOCAL_450361.cpp
.//Collisions/PBD/FiltersUtils_REMOTE_450361.cpp
From this list of files, I want a find command to select the last 4, the ones with BACKUP, LOCAL, REMOTE, BASE.
I have tried this find . -type f -regex '.+_((BACKUP)|(BASE)|(LOCAL)|(REMOTE))_.*'
but doesn't work.
What would be the correct regex?
-regextype egrep
to your command. – nobody Feb 02 '23 at 20:04emacs
- which supports an ERE-style+
quantifier, but grouping and alternation must be escaped like POSIX BRE:'.+_\(BACKUP\|BASE\|LOCAL\|REMOTE\)_.*'
. See also Confusion with Linux find regex – steeldriver Feb 02 '23 at 21:33find . -type f \( -name '*_BACKUP_*' -o -name '*_BASE_*' -o -name '*_LOCAL_*' -o -name '*_REMOTE_*' \)
– steeldriver Feb 02 '23 at 22:06