#!/usr/bin/perl use strict; use warnings; if ( $#ARGV < 2 ) { print "Usage: extract.pl firstLine lastLine filename\n"; exit 1; } my $start = $ARGV[0]; my $stop = $ARGV[1]; my $file = $ARGV[2]; open (FILE,$file) || die "Can't open file \"$file\".\n"; my $count=0; while () { $count++; if ( $count >= $start && $count <= $stop ) { print ; } } close(FILE);