:weather script - calling SED heads ! [longish]

William Park opengeometry-FFYn/CNdgSA at public.gmane.org
Sat Oct 2 18:37:14 UTC 2004


On Sat, Oct 02, 2004 at 02:29:33PM -0400, David J Patrick wrote:
> weather.pl > weather.sc
>   while read a eq b; do
>         case $a in 
>             celsius|conditions|humidity|pressure|wind) echo "$a = $b" ;;
>             place) place=$b ;;
>             updated) updated=$b ;;
>         esac
>     done < weather.sc | sort
>  echo "$place @ ${updated% on *}"

Try
    weather.pl | ( while read a eq b; do
	case $a in 
	    celsius|conditions|humidity|pressure|wind) echo "$a = $b" ;;
	    place) place=$b ;;
	    updated) updated=$b ;;
	esac
    done 
    echo "$place @ ${updated% on *}"
    ) | sort

Or, if you need 'weather.sc' file, then
    weather.pl > weather.sc
    ( ... ) < weather.sc | sort

-- 
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