hi
how can I extract the owner of the file from the find command that I used below
find /home -type f -atime +5
I tried something like this but didnt work.
find /home -type f -atime +5 -ls |cut -f5
hi
how can I extract the owner of the file from the find command that I used below
find /home -type f -atime +5
I tried something like this but didnt work.
find /home -type f -atime +5 -ls |cut -f5
One way:
find /home -type f -atime +5 -exec ls -l {} \;| awk 'print $4}'
Regards
It worked,
but I dont undestand this
why do we use
-exec ls -l {} \;|
why not only ls -l
With the exec command the '{}' is replaced by the current file name, check the manpage of find.
Regards
Actually if your find supports the -ls action, that's fine, too. The problem with cut is that it expects tab-delimited output; you can change that, but using awk instead might be simpler.
thanks