in reply to Want to do One line Perl Command
perl -lne '/\.c$/?$h{$l=$_}++:delete$h{$l}}{unlink keys%h' file.txt