#!/bin/rc flagfmt='n' args='file' if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0) { aux/usage exit usage } argv0=$0 file=$1 tmp1=/tmp/tag.$pid.1 tmp2=/tmp/tag.$pid.2 fn cleanup { rm $tmp1 $tmp2 >[2]/dev/null } fn fatal { echo $argv0: $* >[1=2] cleanup exit $* } tag/read $file >$tmp1 || fatal read cat /fd/0 $tmp1 | awk ' { if($1 == "COMM") key = $1 $2 $3 # FIXME this won''t read past a space in the description else key = $1 if(!x[key]) x[key] = $0 } END { for(i in x) print(x[i]) } ' | tag/sort >$tmp2 || fatal awk if(! ~ $flagn '') cat $tmp2 if not tag/write $file <$tmp2 cleanup