Unix shell prgrams and AI techniques

Terry tcjones at watdragon.waterloo.edu
Thu Jun 16 04:41:31 AEST 1988



Here is a shell program I use to see who else is programming at the same time
as me.
---------------cut here-------------
last > file.last
sort < file.last > file.sorted
cut -c1-18 < file.sorted > file.cut
tr -d ' ' < file.cut > file.names
cut -c19- < file.sorted > file.other.data
paste file.other.data file.names > file.paste
uniq +60 file.paste > file.output

grep 'still logged in' file.last > temp.1
cut -f1 -d' ' < temp.1 > file.logged.in
sort < file.logged.in > file.sorted.logged.in
uniq < file.sorted.logged.in > file2.output

fgrep -f file2.output file.output  > answerfile.out

more answerfile.out
---------------cut here---------------

This program has a lot of problems, uses a lot of CPU and memory.  It
also prints multiple names, even though I use uniq a few times.  I would
be really interested to get some AI techniques to improve it.

-- 
"Waterloo -  I was defeated, you won the war,
 Waterloo -  promised to love you for evermore.
 Waterloo -  couldn't escape if I wanted to.
 Waterloo -  knowing my fate is to be with you."        ABBA.



More information about the Comp.unix.questions mailing list