Remove lines from a file

From Rosetta Code
Revision as of 07:09, 13 July 2011 by rosettacode>Markhobley (moved Remove lines fom a file to Remove lines from a file: typing mistake in title)
Remove lines from a file is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

The task is to demonstrate how to remove a specific line or a number of lines from a file. This should be implemented as a routine that takes three parameters (filename, starting line, and the number of lines to be removed). For the purpose of this task, line numbers and the number of lines start at one, so to remove the first two lines from the file foobar, the parameters should be: foobar, 2, 1

Empty lines are considered and should still be counted, and if the specified line is empty, it should still be removed. However, an appropriate message should appear, if an attempt is made to remove lines beyond the end of the file.