On Thu, 2008-09-18 at 10:21 -0400, Aali Naser wrote: > I still have no luck after trying your suggestions. I could use some > more > ideas if you guys dont mind. Please send them my way, I ll appreciate > it. >
#!/usr/bin/perl use strict; use warnings; my $sep = "\t"; my @tags = ( 'Server Name', 'Manufacturer', 'Model', 'Number Of Processors', 'Mem Total', 'DeviceID', 'Service Pack', ); my %items = (); while( <> ){ chomp; if( /^-+$/ ){ display( %items ); %items = (); }elsif( my @capture = /([^:]*):(.*)/ ){ if( grep { $_ eq $capture[0] } @tags ){ push @{ $items{$capture[0]} }, $capture[1]; } } } if( %items ){ display( %items ); } sub display { my %items = @_; my @list = (); for my $tag ( @tags ){ if( exists $items{$tag} ){ push @list, join( $sep, @{ $items{$tag} } ); }else{ push @list, ''; warn "***** missing field $tag"; } } print join( $sep, @list ), "\n"; } __END__ -- Just my 0.00000002 million dollars worth, Shawn "Where there's duct tape, there's hope." Cross Time Cafe "Perl is the duct tape of the Internet." Hassan Schroeder, Sun's first webmaster "There is more than one way to do things." A Perl axiom -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/