: '@[$]whodo	2.4 05/28/84 20:37:14 Zilog Inc.'
: 'whodo -- combines info from who(1) and ps(1)'
trap  "rm -f /tmp/$$*" 1 2 3
ps -af>/tmp/$$b&
date
/bin/who>/tmp/$$a
ed - /tmp/$$a<<\!
g/^/s/^\(.........\)\(........\).......\(.*\)/\2   \1 \3/
g/^tty[0-9] /s/^tty\([0-9]\) ../ \1/
g/^tty/s/^tty\(..\)../\1/
g/^console/s//co/
w
!
wait
ed - /tmp/$$b<<\!
1d
g/^/s/^\(.......\).\(.....\).\(.....\).\(...\).\(........\).\(..\)...\(.*\)/\6-  \2      \7/
g/-sh$/s/-/+/
g/-csh$/s/-/+/
g/-rsh$/s/-/*/
w
!
sort /tmp/$$a /tmp/$$b >/tmp/$$c
ed - /tmp/$$c<<\!
g/^..+/s/.....//\
s/\([0-9]\)  *.*/\1/\
.-1,.j
g/^..\*/s/.....//\
s/\([0-9]\)  *.*/\1/\
.-1s/ /r/\
j
g/^\(..\)  /s//\
\1  /
g/^\(..\)- /s//  \1/
1,$p
Q
!
rm -f /tmp/$$*
