I am not quite sure about the requirements. If all that this needed is to put blanks for cols 1 and 2 when they are the same as the previous line, then..perhaps..???
#!/usr/bin/perl use strict; use warnings; my $prev_line = <DATA>; $prev_line =~ tr/:/ /; # BTW, tr/// is really fast print $prev_line; while (my $this_line = <DATA>) { $this_line =~ tr/:/ /; my ($prev_cols ,$prev_file_name) = $prev_line =~ /^\s*(.*?)(\S+)\s* +$/; my ($this_cols, $this_file_name) = $this_line =~ /^\s*(.*?)(\S+)\s* +$/; if ($prev_cols eq $this_cols) { $this_cols =~ s/\S/ /g; } print $this_cols, $this_file_name,"\n"; $prev_line = $this_line; } =Prints ULTRIX CW18.72.0.3 IP-HOST1.log DEC_DECSTATION CW180.72.0.3 IP_HOST_AL.log DEC_DECSTATION_ADDR CW180.72.0.3 IP_HOST_al2.log FOR_VISITORS23_HOST HL617.253.1101.2 IP_HOST_hostinfo.log FOR_VISITORS24_HOST HL617.253.1101.2 IP_HOST_hostinfo2.log FOR_VISITORS25_HOST HL617.253.1101.2 IP_HOST_webform3.log IP_HOST_webform4.log FOR_VISITORS25_HOST HL617.253.1201.2 IP_HOST_webform4.log =cut __DATA__ ULTRIX : CW18.72.0.3 IP-HOST1.log DEC_DECSTATION : CW180.72.0.3 IP_HOST_AL.log DEC_DECSTATION_ADDR : CW180.72.0.3 IP_HOST_al2.log FOR_VISITORS23_HOST : HL617.253.1101.2 IP_HOST_hostinfo.log FOR_VISITORS24_HOST : HL617.253.1101.2 IP_HOST_hostinfo2.log FOR_VISITORS25_HOST : HL617.253.1101.2 IP_HOST_webform3.log FOR_VISITORS25_HOST : HL617.253.1101.2 IP_HOST_webform4.log FOR_VISITORS25_HOST : HL617.253.1201.2 IP_HOST_webform4.log

In reply to Re^3: Storing the log file name as key/value in hash by Marshall
in thread Storing the log file name as key/value in hash by Magnolia25

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.