0

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.

Tushar Gautam
  • 458
  • 6
  • 19
aliosman
  • 1
  • 3

2 Answers2

0

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. I.e. (?=.*\.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.

Andris Leduskrasts
  • 1,210
  • 7
  • 16
  • I need logs file under these specific paths /oradata1/oracle/admin/A/scripts/rman_logs/*.log /oracle/oracle/admin/B/scripts/rman_logs/*.log /oradata2/admin/C/scripts/logs/*.log I dont need all log files – aliosman Jul 13 '15 at 13:58
  • @aliosman That's even easier, as you can just use `[^.\/]\.log` to avoid slashes or dots. – Andris Leduskrasts Jul 13 '15 at 19:29
  • Sory, I couldnt say what I mean. I mean user can not see another logs under the scripts folder, they must only can see log files under the rman_logs. Thanks for your help – aliosman Jul 15 '15 at 07:17
0

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.

aliosman
  • 1
  • 3