Skip to content

add head and tail commands

Jeremy Soller requested to merge zdeljkic:head-tail into master

Created by: zdeljkic

Simple implementations of 'head' and 'tail' commands.

They support the -/+ prefixes for line/byte count, e.g. 'tail -n +10 ' prints all but the first 10 lines of the file.

Input files get loaded into memory (one by one), which should be fine for most use cases. This keeps the implementation simple, unlike for example FreeBSD's tail with over 1000 lines of code.

Edit: above is no longer true, it uses efficient implementations now, but doesn't implement the '-' prefix for 'head', e.g. 'head -n -10 '.

Merge request reports