On Linux server I have several files in folder and my question is:
How to find with regex only filename(s), started with foo or bar and ended with .properties. But not any.properties. Only foo-service .properties and bar-service .properties
/home/user/foo-service/src/main/resources/any.properties
/home/user/foo-service/src/main/resources/foo-service.properties
/home/user/foo-service/src/main/resources/bar-service.properties
Try to find with string:
find /home/user/foo-service/src/main/resources/ -maxdepth 1 \
-regextype posix-extended -regex .*(foo|bar).*\.properties
but in result I have all 3 strings, because foo exists in the path (/foo-service/)
I want to find only after the last slash in the path and as a result I need absolute path to the file.