:weather script - calling SED heads ! [longish]

David J Patrick davidjpatrick-rieW9WUcm8FFJ04o6PK0Fg at public.gmane.org
Fri Oct 1 02:13:30 UTC 2004


On Thu, 2004-09-30 at 19:27, William Park wrote:
> On Thu, Sep 30, 2004 at 03:09:18PM -0400, William Park wrote:
> > On Thu, Sep 30, 2004 at 02:32:37PM -0400, David J Patrick wrote:
> > > MATCH:
> > >         celsius = 18
> > >         pressure = 30.06 in / 1018 hPa 
> > >         temperature_celsius = 18
> > >         place = Toronto
> > >         windchill_celsius = 
> > >         wind = 9 mph 15 km/h from the SSW 
> > >         fahrenheit = 64
> > >         updated = 1:00 PM EDT on September 30, 2004
> > >         windchill_fahrenheit = 
> > >         conditions = Clear
> > >         temperature_fahrenheit = 64
> > >         humidity = 59
> > 
> > Given above input, the desired output 
> > 
> >     > Toronto @ 1:00 PM EDT
> >     > celsius = 18
> >     > conditions = Clear
> >     > humidity = 59
> >     > pressure = 30.06 in / 1018 hPa 
> >     > wind = 9 mph 15 km/h from the SSW 
> > 
> > can be obtained as follows, using standard shell:
> > 
> >     while read a eq b; do
> > 	case $a in 
> > 	    celsius|conditions|humidity|pressure|wind) echo "$a = $b" ;;
> > 	    place) place=$b ;;
> > 	    updated) updated=$b ;;
> > 	esac
> > 	echo "$place @ ${updated% on *}"
> >     done < weather.sc | sort
> 
> Well, there is typo here, but I'll let you find out what it is. :-)

Oh Mr Parks, you're a BAD MAN !!

ummmmm updated% should be %updated ??
while a eq b should be $a eq $b .. ?
the word "case" appears to be spelled backwards, near the end .. 

sigh.. I give up !
In the old days, we'd use scisors, gluestick, non-repro blue pens and a
photocopier .. those days are gone. I can also splice 1/4" audiotape and
do tube registration on analog BetaCam cameras.. work with wood, wiring
and plumbing. I play eight instruments and speak four languages, but it
seems BASH is not one of them ...
mebbe a clue ?
djp

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list