As RudiC already has told you: pipe it into mail! There is no need for an intermediary file:
find <...your complete command...> | mail -s "Subject Text" recipient@host
This will generate the list, put it into a mail, label the mail with the subject text "Subject Text" and send it to recipient@host.
But i would like to go over your command itself, because it is unnecessary complicated and will tax your system a lot more than it should.
First:
<..> | awk '{print $3,$4,$9}' | egrep -v "^oasitqtc"
The egrep
is completely unnecessary because awk
can do that itself:
<..> | awk '! /^oasitqtc/ {print $3,$4,$9}'
Instead of producing all lines first and filter out the ones you are not interested in you start with only the ones you are interested in in first place.
Next:
find . -type d -exec ls -ld {} \; | <...>
This makes find
first produce a list of directory names and then invoke the ls
command once for every directory found that way. There is a built-in functionality in find
which does about the same:
find . -type d -ls | <...>
The format is a little different (it is like ls -ails
) which means you will have to modify the awk
-command following a little bit. But this will definitely save the system some thousands of unnecessary calls to ls
.
Next:
find . -type d -exec ls -ld {} \; | awk '{print $3,$4,$9}' | egrep -v "^oasitqtc"
As i take it you are searching for directories owned (or, in your case: NOT owned) by a specific user ("oasitqtc"). For this find
also has a built-in provision: the -user
clause. It takes a user name (or user ID) and presents only the files/directories found that are owned by that user. For instance:
find . -type d -name "abc*" -user myuser
will find in the current directory all directories with names starting with "abc" and owned by user "myuser". You will have to reverse that, which is also possible (notice the "!", which is a logical NOT), and you do neither awk
s ability to filter out lines nor egrep
to do the same:
find . -type d ! -user oasitqtc -ls | awk '{print ...... }'
Again: because of the different output format you will have to modify the awk
-statement to only leave the necessary information. If you have GNU-find (like if you work on a Linux-System) you could use the -printf
-clause and you would not need awk
at all.
I hope this helps.
bakunin