#!/usr/bin/perl
#==============================================================================
# Script:   sortEchoArea.pl
# Author:   Michael Dukelsky, 2:5020/1042
# Date:     15 Feb 2007
# Description:
#   This is a filter for sorting HPT EchoArea descriptions
# Usage:
#   perl sortEchoArea.pl <unsorted.cfg >sorted.cfg
#==============================================================================

use strict;
my ($line, @areas, @sorted);
while ($line = <>)
{
    push @areas, $line;
};

@sorted = sort {
                    my ($tag1) = $a =~ /^\s*EchoArea\s+(\S+)\s+/i;
                    my ($tag2) = $b =~ /^\s*EchoArea\s+(\S+)\s+/i;
                    uc($tag1) cmp uc($tag2);
               } @areas;

foreach $line (@sorted)
{
    print $line;
};
