Article View: net.games.emp
Article #52famine
From: utzoodecvaxucbvaxucsfcglsdcarlru...
Date: Thu, 13 May 1982 18:39
Date: Thu, 13 May 1982 18:39
34 lines
954 bytes
954 bytes
Here is a shell script that if run on a census report will print
the census report with
(1) the total population in that census
(2) the minimum amount of food for that census for a day
(3) an asterisk at the end of the line if that census is too low
Here it is:
#! /bin/sh
if test $# -lt 1
then
echo "usage: famine census1 census2 ..."
exit 1
fi
for file
do
cat $file | 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
} } '
done
Technical Details
Message-ID:
<bnews.sdcarl.294>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: famine Article-I.D.: sdcarl.294 Posted: Thu May 13 18:39:30 1982 Received: Fri May 14 05:28:47 1982 Subject: famine Date: Thu, 13 May 1982 18:39:30 +0000 Message-ID: <bnews.sdcarl.294>