:weather script - calling SED heads ! [longish]
William Park
opengeometry-FFYn/CNdgSA at public.gmane.org
Thu Sep 30 23:27:39 UTC 2004
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. :-)
--
William Park <opengeometry-FFYn/CNdgSA at public.gmane.org>
Open Geometry Consulting, Toronto, Canada
--
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