:   bm# 0000001177
:   typ S
:   ver generic
:   mod generic
:  
#     SCCSID(@(#)whodo.sh	1.1);


:
: pjk 24 Feb 1984	L000
:	- directed std out from ed to null
:
: '/etc/whodo -- combines info from who(1) and ps(1)'

trap  "rm -f /tmp/$$*" 1 2 3
ps -a>/tmp/$$b&
date
/bin/who>/tmp/$$a
: L000
ed - /tmp/$$a >/dev/null <<\!
g/^/s/^\(.........\)\(........\).......\(.*\)/\2 \1 \3/
g/^tty/s/^tty\(..\)../\1/
g/^console/s//co/
w
!
uname
wait
: L000
ed - /tmp/$$b >/dev/null <<\!
1d
g/^/s/^\(......\).\(..\)\(.*\)/\2-  \1\3/
g/-sh$/s/-/+/
g/-rsh$/s/-/*/
w
!
sort /tmp/$$a /tmp/$$b >/tmp/$$c
: L000
ed - /tmp/$$c >/dev/null <<\!
g/^..+/s/.....//\
s/\([0-9]\)  *.*/\1/\
.-1,.j
g/^..\*/s/.....//\
s/\([0-9]\)  *.*/\1/\
.-1s/ /r/\
j
g/^\(..\)- /s//  \1/
w
!
: L000
cat /tmp/$$c
rm -f /tmp/$$*
