#!/usr/bin/perl -wT use strict; my $calog = "/var/log/ca/ca.log"; my $line; my @certs; # open LOG, "$calog" or die "Can't open $calog: $!\n"; while ($line = <DATA>){ # Switched to __DATA__ j +ust for example if ($line =~ m/\'([-.\w]+)\'\s+added/) { # Make this Regex a bit s +marter push(@certs,$1); # add the piece in parens + above to the @certs array } #end if } #end while print "$_\n" for @certs; # print out the array __DATA__ Sep 12 17:30:02 nt-ca-na CA(Domain-CA): Certificate name 'jsmith.2048' + added to\ database. Sep 12 20:09:37 nt-ca-na CA(Domain-CA): Certificate name 'ksmith.2048' + added to\ database. Sep 12 21:25:30 nt-ca-na CA(Domain-CA): Certificate name 'ssmith.2048' + added to\ database. =output jsmith.2048 ksmith.2048 ssmith.2048
-Blake
In reply to Re: Array Problem
by blakem
in thread Array Problem
by dru145
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |