From: utzoo!decvax!ucbvax!ucsfcgl!sdcarl!rusty Newsgroups: net.games.emp Title: Re: famine Article-I.D.: sdcarl.295 Posted: Thu May 13 18:49:27 1982 Received: Sat May 15 03:49:02 1982 The "cat" is unnecessary: #! /bin/sh : famine is a widget for empire. : given a census report from empire : it prints the population per sector : along with the minimum amount of : food necessary for that sector. : sectors that are below this minimum : are flagged with an asterisk. if test $# -lt 1 then echo "usage: famine census1 census2 ..." exit 1 fi for file do awk ' { if ( NR < 3 ) print } { if ( NR == 3 ) print $0 " pop minf" } { if ( NR > 3 ) { pop = $7 + $8 minf = pop * 0.048 if ( minf < 1 ) minf = 1 warn = "" if ( $9 < minf ) warn = "*" printf "%s %3d %4.0f %s\n", $0, pop, minf, warn } } ' $file done