:
#-------------------------------------------------------------------------------
# @(#)cobrps   1.0
#
# $Revision:   1.3  $
# $Date:   29 Jul 1999 15:59:10  $
# $Author:   RHS  $
#
# Remote process list
#  Output:	<processid><tab><other information><newline>
#
# N.B.
#   This script must not make ANY assumptions about the environment in which it
#   executes: in particular, it must not assume that COBDIR, PATH, LIBPATH, 
#   LD_LIBRARY_PATH, etc., are set.
#-------------------------------------------------------------------------------

PATH=/usr/bin

AWK_SCRIPT=/tmp/awk.$$
SED_SCRIPT=/tmp/sed.$$

# create sed edit script
(
# Remove processes that do not have a terminal
echo '/@*[ ]*- /d'
echo '/@*[ ]*? /d'

# Remove xterms
echo '/ xterm /d'

# Remove dead processes
echo '/<defunct>/d'

# Remove applications and utilities
echo '/ vi /d'
echo '/ who /d'
echo '/ sed /d'
echo '/ awk /d'
echo '/ grep /d'
echo '/ head /d'
echo '/ tail /d'
echo '/ rlogin /d'
echo '/ fvwm /d'
echo '/ xclock /d'
echo '/ tar /d'
echo '/ xinit/d'
echo '/ ps /d'
echo '/ sh /d'
echo '/ csh / d'
echo '/ ksh / d'
echo '/ bash /d'
echo '/ -sh /d'
echo '/ -csh / d'
echo '/ -ksh / d'
echo '/ -bash /d'
echo '/ sh$/d'
echo '/ csh$/ d'
echo '/ ksh$/ d'
echo '/ bash$/d'
echo '/ workman /d'
echo '/animserv/d'
) > $SED_SCRIPT

#create awk edit script
(
echo '{  	printf("%s\t%10s @ %8s (",$1,$2,$3);'
echo '		for (i = 4; i < NF; i++) printf("%s ",$i);  '
echo ' 		printf("%s)\\n", $NF); } '
) > $AWK_SCRIPT

# list processes owned by the user of this script, remove irrelevant processes,
# and format the remainder
ps -a -o pid,user,tty -o args | grep `who am i | awk '{print $1}'` |
sed -f $SED_SCRIPT | awk -f $AWK_SCRIPT

# delete the temporary files
rm -f $AWK_SCRIPT
rm -f $SED_SCRIPT
#-------------------------------------------------------------------------------
