User's manual. Section 1.

LNS(1): print lines



Lns prints selected lines for files in the input. Lines are specified as ranges. A range may be a single line number, counting from 1, or a pair of start and end line numbers separated by a "," character. Negative line numbers count backwards from the end of the file (the last is -1 and so on).

Multiple ranges may be given. But beware, in such case, to avoid storing the entire file, ranges involving only positive line numbers are printed first and then ranges involving negative line numbers. Depending on the ranges given, this might lead to unsorted line prints.

A missing start number in a range means 1, and a missing end number in a range means -1. If no range is given, "," is implied. And, when such range is indicated, all lines are printed, one line at a time. This is useful to generate messages into the output for each single line in the input.


Print the first two lines and the last two lines of the input

Apply cmd to each line of Go sources files


User's manual. Section 1.