#!/usr/bin/env perl
##
## Copyright (c) 2012 The University of Utah
## All rights reserved.
##
## This file is distributed under the University of Illinois Open Source
## License.  See the file COPYING for details.

###############################################################################

use strict;
use warnings;

use File::Temp;

die unless (scalar(@ARGV)==3);

(my $fn, my $command, my $number) = @ARGV;

(my $TMP, my $tmpfilename) = File::Temp->tempfile("tempXXXXX", 
						  UNLINK => 0);
open INF, "<$fn" or die;
my $count=0;
while (my $line = <INF>) {
    if ($count == $number) {
    } else {
	print $TMP $line;
    }
    $count++;
}
close INF;
close $TMP;
print "$tmpfilename\n";
system "mv $tmpfilename $fn";
