Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a script:

egrep -R -s -c '([^0-9a-zA-Z_-]|^)(5[1-5][0-9]{2}( |-|)([0-9]{4})( |-|)([0-9]{4})( |-|)([0-9]{4}))([^0-9a-zA-Z_-]|$)' $searchpath | egrep '\:[^0]' > $logfilename

It needs to be modified to search only /home non-root and /tmp directories.

Home directories (off root)
Temp directories (off root listed as tmp)

*Websphere logs: Getting Specs for these logs

*Apache logs: Getting Specs for these logs

The output file should include the server name. The search results should be empty, please create a log file, showing start, stop time and server name, no records found.

share|improve this question

1 Answer 1

Sounds like homework.

If the paths to the (/tmp) directories (including their name) to be searched do not contain whitespace (which is quite probable) and assuming that all home directories are in /home and that nothing except for home directories is there then $searchpath can be replaced by pattern matching and (for the /tmp owner check) a find call:

... /home/* $(find /tmp -mindepth 1 -maxdepth 1 -type d \! -user root) | egrep ...
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.