:weather script - calling SED heads ! [longish]
William Park
opengeometry-FFYn/CNdgSA at public.gmane.org
Thu Sep 30 19:09:18 UTC 2004
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
> Using location: 43.400000N, 79.240000W
> Date: 30 Sep 2004
> Local time: 13:46
> Day length: 11:45 hours
> With civil twilight 12:39 hours
> With nautical twilight 13:45 hours
> With astronomical twilight 14:52 hours
> Length of twilight: civil 0:26 hours
> nautical 1:00 hours
> astronomical 1:33 hours
> Current specified time zone: EDT (-4 from UTC)
> Sun transits meridian 1306 EDT
> Sun rises 0715 EDT, sets 1857 EDT
> Civil twilight starts 0646 EDT, ends 1926 EDT
> Nautical twilight starts 0613 EDT, ends 1959 EDT
> Astronomical twilight starts 0540 EDT, ends 2032 EDT
Given above input data, the desired output
> Sun rises 0715 EDT, sets 1857 EDT
can be obtained by
sed -n '/Sun rises/s/^ *//p' < astro.sc
--
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