A program I wrote many years ago when I wanted to select specific parts of text files. It combines piped combinations of the Unix programs "head" and "tail". The source is very simple, so should compile without problems.

The syntax is: list  [-sl] [+el] [-sl+el] [-sl-el] [-nvd] [files...]


sl is a start line number (1-based), and el is an end line number (1-based, inclusive)
-sl means list from start line to end
+sl means list up to start line (i.e. list "sl" lines)
-sl+el means list from start and then "el" lines thereafter
-sl-el means list from start line to end line
-n means add a line number before each line. The number added relates to the input.
-v means invert the range selected (so +5 would mean list all but the first 5 lines)
-d means display the name of the file at the start of the output.

I know it works for gcc v3 and v4 on Linux.

Attachment Size
list.c 6.44 KB
Public Domain