blackadder has asked for the wisdom of the Perl Monks concerning the following question:
I need to read the file into an array where where each elemnt of the array is a chunk of data between a ------ and *****show tech-support details -------------------- show switchname ------------------ CCC216_MX_RED ****************************************************************** -------------------- show interface mgmt0 ------------------ mgmt0 is up Hardware is FastEthernet Address is 000f.3494.9a0c Internet address is 10.3.811.51/20 MTU 1500 bytes, BW 100 Mbps half Duplex 67992323 packets input, 2147483647 bytes 0 multicast frames, 0 compressed 0 input errors, 0 frame, 0 overrun 0 fifo 18569093 packets output, 1762088350 bytes, 0 underruns 0 output errors, 29925 collisions, 281 fifo 10686 carrier errors ****************************************************************** -------------------- show version ------------------ Cisco Storage Area Networking Operating System (SAN-OS) Software TAC support: http://www.cisco.com/tac Copyright (c) 2002-2004, Cisco Systems, Inc. All rights reserved. The copyrights to certain works contained herein are owned by other third parties and are used and distributed under license. Some parts of this software are covered under the GNU Public License. A copy of the license is available at http://www.gnu.org/licenses/gpl.html. Software BIOS: version 1.1.0 loader: version 1.2(2) kickstart: version 2.0(3) system: version 2.0(3) ******************************************************************
but the $data only contained the first line of the log file!#! c:/perl/bin/perl.exe use strict; open (LST,"c:/test/showtech215.txt")||die "$^E ; $!\n"; chomp (my $data = <LST>); print "$data" #my @array = split /\*+/,$data;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Spliting a log file into chunks and saving it into an array
by Zaxo (Archbishop) on Sep 15, 2005 at 09:47 UTC | |
|
Re: Spliting a log file into chunks and saving it into an array
by Samy_rio (Vicar) on Sep 15, 2005 at 09:27 UTC | |
by tbone1 (Monsignor) on Sep 15, 2005 at 13:33 UTC | |
by Tanktalus (Canon) on Sep 15, 2005 at 15:48 UTC | |
|
Re: Spliting a log file into chunks and saving it into an array
by Hue-Bond (Priest) on Sep 15, 2005 at 20:09 UTC | |
|
Re: Spliting a log file into chunks and saving it into an array
by Anonymous Monk on Sep 15, 2005 at 12:52 UTC |