Hi Charles,  thanks for your help.

Here is I ended up doing this, it is too long and bulky.
#!/usr/bin/perl

<Blah, blah, blah ............. more perl code......>

sub w1_connect_info {
    # This routine extract available info passed in the getty logs.
    # Here is a sample of the line we are looking for:
    # 02/18 15:54:26 ##### data dev=ttyC12, pid=13032, caller='none',
conn='31200/LAPM/V42BIS', name='', cmd='/usr/sbin/pppd', user='/AutoPPP/'
    my ($getty_id,$ttydev) = @_;
    my ($line,$item);
    my (@getty_line);

    open (GETTYFILE, "</var/log/getty.log.$ttydev") || die "Can't open
log.$ttydev: $!";
    while ($line = <GETTYFILE>) {
 if ($line =~ /$getty_id/ && $line =~ /$ttydev/) {   # I am looking for a
certain PID and a certain tty
     $line =~ s/^(\d{2}\W{1}\d{2}\s+(..):(..):(..)\s+#####\s+data\s+)//m;  # Get
rid of the date stuff
     $line =~ s/,{1}/","/g; # replace the comma delimiters with a ",". This will
surround the fields
                            # with quotes.
     $line =~ s/\s+//g;            # Rid the white spaces
     $line = "\"" . $line . "\"";  # Add quotes on both ends to close the first
and last set of quotes.
     print "This is the new \$line: ",$line;
     my ($coded) = "push (\@getty_line, $line);";
     print "This is the \$coded: ",$coded;
     eval $coded;
     print "getty data: ",@getty_line[3],"\n";
 }
    }
} # sub w1_connect_info



I am still trying to get your single line while statement to roll but I get an
empty array.

Charles Galpin wrote:

> If this did what you wanted Robert, then please ignore. But from the looks
> of it, this will just get the first item1='value' from each line.
>
> The following gets all values on each line, using your example data.
>
> #!/usr/local/bin/perl -n
>
> # this is what you want
> push (@list, $1) while ( /.*?='(.*?)'/g );
>
> # test what we got
> $i=1;
> print "Current Line: $_";
> foreach $item ( @list ) { print "item" . $i++ . " = $item\n"; }
>
> hth
> charles
>
> p.s. who or what is inseerting the list name into the subject (which I
> removed), and why?

Hmm,  I not sure I know what your talking about.  The post I received did not
have that in it.

--
robert canary
system services
OhioCounty.Net
[EMAIL PROTECTED]
(270)298-9331 Office
(270)298-7449 Fax



-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to