perl -i.bak -ne 'print unless $h{$_}++' file