mimicking linux head and tail commands.