#!/usr/local/bin/perl -w use strict; my %data; my $sid; my $day; while () { next if (/Default/); if (/Policy Name:(\s+)(.*?)$/) { $sid = "$2"; next; } next unless (/(\s+)Daily Windows\:/ .. /(\s+)Schedule\:/); if (/(^\s+)(.*?day)/) { next if (/24|Week/); $day = $_; chomp $day; push @{$data{$sid}}, $day; } } foreach my $key (sort keys %data) { print "$key runs on\n"; foreach (@{$data{$sid}}) { print "$_\n"; } }