Return-Path: <mcguyton@MIT.EDU>
Received: from central-city-carrier-station.mit.edu by po11.mit.edu (8.9.2/4.7) id NAA21615; Tue, 9 Apr 2002 13:22:39 -0400 (EDT)
Received: from manawatu-mail-centre.mit.edu (MANAWATU-MAIL-CENTRE.MIT.EDU [18.7.7.71])
	by central-city-carrier-station.mit.edu (8.9.2/8.9.2) with ESMTP id NAA25200
	for <sipb@mit.edu>; Tue, 9 Apr 2002 13:22:09 -0400 (EDT)
Received: from department-of-alchemy.mit.edu (DEPARTMENT-OF-ALCHEMY.MIT.EDU [18.7.16.69])
	by manawatu-mail-centre.mit.edu (8.9.2/8.9.2) with ESMTP id NAA17999
	for <sipb@MIT.EDU>; Tue, 9 Apr 2002 13:22:09 -0400 (EDT)
Received: from localhost (mcguyton@localhost) by department-of-alchemy.mit.edu (8.9.3) with ESMTP
	id NAA18927; Tue, 9 Apr 2002 13:22:09 -0400 (EDT)
Date: Tue, 9 Apr 2002 13:22:09 -0400 (EDT)
From: Matthew Guyton <mcguyton@MIT.EDU>
To: <sipb@mit.edu>
Subject: Re: linux command help
In-Reply-To: <Pine.GSO.4.30L.0204041307110.29219-100000@multics.mit.edu>
Message-ID: <Pine.GSO.4.30L.0204091318080.10814-100000@department-of-alchemy.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

Thanks for the response.

I think it's slightly more complicated than I initially imagined.

The wea command changes its output style depending on the time of day.

For instance, now, there is no "Today" but there is a "This afternoon" and
a "Tonight".  It also puts a new line at the end of each word-wrapped
line.  If Today's forecast is multiple lines, this prevents the entire
forecast for "Today" from being printed out in the method below (only the
first line of text gets printed).

I think we need to print out every line up to, but not including whatever
contains "nday:", "sday:", "iday:", or "rday".

Any ideas?

Thank you,
Matt

--------
On Thu, 4 Apr 2002, Jacob Morzinski wrote:

On Thu, 4 Apr 2002, Matthew Guyton wrote:
> I'm trying to figure out how to print out the weather forecast for today
> only:

You can either use standard sed or use GNU grep to print all lines up
to and including the match.  Both of the following two lines produce
the same output.  (I'm using ggrep from the gnu locker; linux would
have gnu grep installed as "grep".)

% athrun weather weather -f bos -h -z | sed -n '1,/Today/p'
% athrun weather weather -f bos -h -z | ggrep -B100 Today

The output is:

Zone: Suffolk County including Boston and Cambridge (MA015)
922 AM EST THU APR 4 2002
   Today: Partly sunny.  Highs near 50.  Northwest wind 10 to 20 mph.



