in reply to Delete Duplicate Entry in a text file

#!usr/bin/perl use strict; open (FH,"hostR.txt")or die "cannot open a file \n"; open (FH1,">hostRR.txt")or die "cannot open a file \n"; local $/; my $fileData = <FH>; close FH; if ($fileData =~ s/(\w+\s\w+)\s*\1\s*\1/$1/gi){ print FH1 $fileData; } close FH1;

################ You can use the above regular expression to remove consecutive duplicates from your file