Article View: net.games.emp
Article #53Re: famine
From: utzoodecvaxucbvaxucsfcglsdcarlru...
Date: Thu, 13 May 1982 18:49
Date: Thu, 13 May 1982 18:49
33 lines
990 bytes
990 bytes
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
Technical Details
Message-ID:
<bnews.sdcarl.295>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
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 Subject: Re: famine Date: Thu, 13 May 1982 18:49:27 +0000 Message-ID: <bnews.sdcarl.295>