#!/usr/bin/perl use strict; use warnings; my $prev_line = ; $prev_line =~ tr/:/ /; # BTW, tr/// is really fast print $prev_line; while (my $this_line = ) { $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