in reply to Re: greping for a value
in thread new : greping

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

Replies are listed 'Best First'.
Re^3: greping for a value
by pingme8705 (Acolyte) on Sep 08, 2005 at 04:18 UTC
    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.