#!perl use strict; use warnings; use autodie qw( open close ); open my $input_fh, '<:encoding(UTF-8)', shift @ARGV; open my $output_fh, '>:encoding(UTF-8)', 'Output.txt'; while (my $line = <$input_fh>) { chomp $line; my @tokens = split ' ', $line; if ($tokens[0] eq 'object-group') { print {$output_fh} "set shared address-group $tokens[2]\n"; } } close $input_fh; close $output_fh; exit 0;