in reply to new : greping

Not sure about the excel part, but this might be a starting point...

use strict; use warnings; $_ = q|device1 is 2.3.5.1 . . . 56% /var 38% / 31% Interleaved device1 + Tue Sep 9 11:26:44 ist 2005 logging to device2 is 2.3.5.1 . . . 56% +/var 44% / 31%|; my @arr = /(device\d+)\sis\s.+?\/var\s+(\d+%)/g; print "@arr";

Replies are listed 'Best First'.
Re^2: greping for a value
by svenXY (Deacon) on Sep 07, 2005 at 11:00 UTC
    about the excel part:

    if you create a csv file that is tab delimited and name it with an extension of .xls, Excel will correctly open it.

    To get the device name as well, I'd do it as follows:
    use strict; use warnings; my %devices; $_ = q|device1 is 2.3.5.1 . . . 56% /var 38% / 31% Interleaved device1 + Tue Sep 9 11:26:44 ist 2005 logging to device2 is 2.3.5.1 . . . 56% +/var 44% / 31%|; my @arr = /(device\d+)\sis\s.+?\/var\s+(\d+%)/g; %devices = @arr; open(XLS, ">/path/to/file.xls") or die "Could not open file: " . $!; foreach my $device (sort keys (%devices)) { print XLS $device . "\t" . $devices{$device} . "\n"; } close XLS;
    Cheers
    Sven
      hi !
      my @arr = /(device\d+)\sis\s.+?\/var\s+(\d+%)/g;
      gives the output for /var
      device1 38% device2 44%
      but it should be
      device1 56% device2 56%
      i m now checking on that and also trying to take the data from the text file itself.
Re^2: greping for a value
by pingme8705 (Acolyte) on Sep 07, 2005 at 10:51 UTC
    hi ! Thank you it helped to narrow down a bit ! i m from india. if u come anytime to india tell me i here to help ! just mail me to pingme8705@gmail.com! thank u man ! it helped to narrow down!