open the file;
open a temp file for output;
set $lastrow to '';
while (file not empty) {
read one row;
if (this row equals to the $lastrow) {
do nothing;
} else {
write this row to the output file;
set $lastrow to this row;
}
}
close both files;
copy the temp file to the original file;
####
use strict;
use warnings;
my $lastrow = "";
while (my $line = ) {
$line =~ /(.*?)\n/;
$line = $1;
if ($line ne $lastrow) {
print $line, "\n";
$lastrow = $line;
}
}
__DATA__
data_row_051126120432.data
data_row_051126120630.data
data_row_051126120630.data
data_row_051126122305.data
data_row_051126122305.data
##
##
data_row_051126120432.data
data_row_051126120630.data
data_row_051126122305.data