- 论坛徽章:
- 0
|
mcshell 发表于 2012-09-20 10:31 ![]()
回复 2# sjdy521
哪里重复了?
try~- #!/usr/bin/perl
- use strict;
- use warnings;
- use Data::Dumper;
- my $str = do{local $/; <DATA>};
- my @chunks = split /^(?=\S)/m,$str;
- my %xml;
- while (@chunks) {
- my $text = shift @chunks;
- open my $fh, "<", \$text or die($!);
- my $title = <$fh>; # etc/....
- $title .= <$fh>; # dest...
- push @{ $xml{$title} },<$fh>;
- close($fh);
- }
- while (my($k,$v) = each %xml) {
- print $k, @{$v};
- }
- __DATA__
- etc/xml/validation/dataFileFormatDefs.xml:
- destinations:
- dtsystem@app8002:/mnt/configs/production02/default/itm
- dtsystem@app8003:/mnt/configs/production03/default/itm
- dtsystem@app8004:/mnt/configs/production04/default/itm
- dtsystem@app8005:/mnt/configs/production05/default/itm
- etc/xml/validation/dataFileFormatDefs.xml:
- destinations:
- dtsystem@app8002:/opt/demandtec/production/etc/xml/validation
- dtsystem@app8003:/opt/demandtec/production/etc/xml/validation
- dtsystem@app8004:/opt/demandtec/production/etc/xml/validation
- dtsystem@app8005:/opt/demandtec/production/etc/xml/validation
- dtsystem@pns8001:/opt/demandtec/production/etc/xml/validation
- buildNumber.txt:
- destinations:
- dtsystem@app8002:/opt/demandtec/production/lib
- dtsystem@app8003:/opt/demandtec/production/lib
- dtsystem@app8004:/opt/demandtec/production/lib
复制代码 |
|