I have a log file as below;
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) ******************************************************************
I need to read the file into an array where where each elemnt of the array is a chunk of data between a ------ and *****

I tried reading the whole file into a $data and then split it like so
#! 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;
but the $data only contained the first line of the log file!

Any idea how can I achieve this?

Regards
Blackadder

In reply to Spliting a log file into chunks and saving it into an array by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.