EDITED:
I need to use -E for extended regex.
I have a folder with this files (just an example):
I'm trying to find all files that:
- Start and end with
#
. (e.g#hi.h#
) - End with
~
. (e.gfile.txt~
)
I can find 1 condition files or 2 condition files, but i can't combine both in one regex.
$ find . -regex "./.*~"
./lld~
$ find . -regex "./#.*#"
./#x2#
./#x#
But this command is not working:
$ find . -regex "./(.*~$)|(#.*#)"
What am I doing wrong? how I can combine these regexes?
Best Answer
Does this work for you?