#!/usr/bin/perl while (<>) { if (/^score\s+(\S+)\s/){ $seen{$1} and next; $seen{$1}=1; print; } else { print; } }