#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: mtt_find
# mtt_find path name operation
# P.J.Gawthrop Nov 1996
# Copyright (c) P.J.Gawthrop 1996
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3 1998/07/16 09:15:34 peterg
## Now prints:
## dir
## name_lbl.txt
## access time
##
## Revision 1.2 1997/09/04 09:15:19 peterg
## Includes summary line as well as description lines
##
## Revision 1.1 1996/11/10 10:48:45 peterg
## Initial revision
##
###############################################################
path="$1"
if [ -n "$2" ]; then
name="-name $2"
fi
q=\
paths=`echo $path | tr ":" " "`
foundpath=`\
for thepath in $paths; do
find $thepath -type d $name -print
done | \
sort -u`
# If non-null result, check that the name_lbl.txt file exists in dir name
# and print dirname and file name and last access time
if [ -n "$foundpath" ]; then
for thepath in $foundpath ; do
dirname=`echo $thepath | awk -F/ '{print $NF}'`
fullname="$dirname"_lbl.txt
find $thepath -maxdepth 1 -name $fullname -printf '%h\t%f\t%Ac\n';
done
fi