RE: Help with sorting another file


Subject: RE: Help with sorting another file
From: Arthur Corliss (acorliss@nevaeh-linux.org)
Date: Fri Feb 27 2004 - 09:57:44 AKST


On Thu, 26 Feb 2004 jonr@destar.net wrote:

> This is basically how the file looks, I cut some of the program info out
> because I don't want an email thats so big. This shows what I am trying to
> do, look at the last 2 entries and there is no stop= times. Simply remove
> those entries without a stop= time...hahah, simply. ;)

The simplest solution is based on the assumption that the blocks missing the
stop time have the following template:

  <programme start="*" channel=

i.e., start is always followed by stop when present. If this assumption holds
true then:

  cat $file | sed '/<programme start="[^"]*" channel=/,/<\/programme>/d' \
> ${$file}.new

will do it. If tags can be in an arbitrary order you're going to need either
a proper XML parser or a more complicated sed script. ;-)

        --Arthur Corliss
          Bolverk's Lair -- http://arthur.corlissfamily.org/
          Digital Mages -- http://www.digitalmages.com/
          "Live Free or Die, the Only Way to Live" -- NH State Motto
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Fri Feb 27 2004 - 09:58:14 AKST