I need a nice column for Centrify tool which include all the log files under the different folders, for example;
/oradata1/oracle/admin/A/scripts/rman_logs/*.log
/oracle/oracle/admin/B/scripts/rman_logs/*.log
/oradata2/admin/C/scripts/logs/*.log
I used this but after the * character user can see all logs; /ora(data(1|2)|cle)/oracle|admin/admin/*/scripts/rman_logs
/ora(data(1|2)|cle)/oracle|admin/admin/*/scripts/rman_logs
Which expression I must use.
If I understandy our question correctly, you want only .log
files. You can use a positive lookahead to assert that it is indeed a log
file (contains .log
at the end of filename), and match the filename whatever it is (.*)
.
Then it's really easy. (?=.*\\.log(?:$|\\s)).*
Of course, you can also add specific folders if you wish to restrict the matches, but the positive lookahead will still do its work. Ie (?=.*\\.log(?:$|\\s)).*/scripts/.*
EDIT: As your comment, you only need those folders, so you just specify their filepaths in alternations and add [^.\\s\\/]*\\.log
at the end. So:
(?:\\/oradata1\\/oracle\\/admin\\/A\\/scripts\\/rman_logs\\/|\\/oracle\\/oracle\\/admin\\/B\\/scripts\\/rman_logs\\/|\\/oradata2\\/admin\\/C\\/scripts\\/logs\\/)[^\\s.\\/]*\\.log
You may shorten the regex by trying to combine filepath elements, but, imo, not necessary as you might as well specify each filepath individually, if they don't overlap too much.
I have found a global expression.
this is not a good way but it works and save me from lots of job. The main files are under the ....../scripts/rman_logs/ for all servers so I use this way.
I can produce these lines and can be a command group for users so this works good
tail / / / / /scripts/rman_logs/*.log
tail / / / /scripts/rman_logs/ .log
Thanks for your helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.