You could adapt the following script
run using: finds /home | tail -10
or
finds /home | grep username | tail -10
Mike
#!/usr/bin/ksh
#
# Script: finds
# Aim: List files in a filesystem by modification time
#
awk="/usr/bin/awk"
basename="/usr/bin/basename"
cut="/usr/bin/cut"
date="/usr/bin/date"
find="/usr/bin/find"
sed="/usr/bin/sed"
sort="/usr/bin/sort"
#
# Functions
#
checkParms()
{
FILELIST=""
for parm in $PARMS
do
if test "$parm" = "-r"
then
REVERSE="r"
else
check=`echo "$parm" | $cut -c1 `
if test "$check" != "-"
then
FILELIST="$FILELIST $parm"
fi
fi
done
return
}
showFiles()
{
(
$date +"%Y %m %d"
$find $FILELIST -xdev -type f -ls
) |
$awk '
NR == 1 {
thisyear = $1
lastyear = $1
thismonth = substr($2+100,2,2)
thisday = substr($3+100,2,2)
}
NR != 1 {
day = substr($9+100,2,2)
if ( $8 == "Jan" ) { month = "01" }
if ( $8 == "Feb" ) { month = "02" }
if ( $8 == "Mar" ) { month = "03" }
if ( $8 == "Apr" ) { month = "04" }
if ( $8 == "May" ) { month = "05" }
if ( $8 == "Jun" ) { month = "06" }
if ( $8 == "Jul" ) { month = "07" }
if ( $8 == "Aug" ) { month = "08" }
if ( $8 == "Sep" ) { month = "09" }
if ( $8 == "Oct" ) { month = "10" }
if ( $8 == "Nov" ) { month = "11" }
if ( $8 == "Dec" ) { month = "12" }
if ( length($10) == 4 )
{
year = $10
hour = "00:00"
}
else
{
if ( month <= thismonth ) { year = thisyear }
if ( month > thismonth ) { year = lastyear }
hour = $10
}
print year "/" month "/" day, hour, $0
}
' |
$sort $REVERSE |
$cut -c17-
return
}
#
# Start of main processing
#
SCRIPT=`$basename $0 `
PARMS="$*"
showFiles
exit 0
--
| Mike Nixon
| Unix Admin
|
----------------------------