#!/usr/bin/perl -w

use warnings;
use strict;
use Getopt::Long;

my $server = undef;
GetOptions ("server|s=s" => \$server);

my @cmdOut = `echo "show.labels;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
my $line;
my $passedHeader=0;
foreach $line (@cmdOut) {

    chomp($line);
    if ($line =~ m/pantasks:\s+(.*)/) {
  
        # HACK to get around 'dummy' label in stdscience
        if ($1 !~ m/.*dummy.*/) {print "$1\n"};
        $passedHeader=1; 
        next;
    }

    if ($passedHeader){print "$line\n";}
}
