HI Guys,
I'm a newbie in perl.
HI Guys,
I'm a newbie in perl.
Please wrap your exsample in CODE tags!
Is the following what you want?
perl -ne 'print if s|^<certificate FullCert="(.*)"/>|$1|' file.xml
[quote=madeingermany;302774275]
Please wrap your exsample in CODE tags!
Is the following what you want?
#!/usr/bin/perl
use strict;
use warnings;
open my ($in_fh), '<', 'infile.xml'
or die "Could not open input file: $!\n";
my %certs;
while(<$in_fh>) {
push ( @{$certs{$2}}, $1) if (my ($cert, $name) = /^<certificate FullCert="([^"]+)".* name="([^"]+)"/);
}
close $in_fh;
for my $cert_name (keys %certs) {
open my $out_fh, '>', $cert_name
or warn "Could not open output file ($cert_name): $!\n";
printf $out_fh "%s\n", $_ for (@{$certs{$cert_name}});
}
Perfect!!!! This is what i wanted...thanks a ton!! ![]()