[TUHS] head/sed/tail (was The Unix shell: a 50-year view)

arnold at skeeve.com arnold at skeeve.com
Thu Jul 15 14:19:39 AEST 2021


Douglas McIlroy <douglas.mcilroy at dartmouth.edu> wrote:

> -r is weird because it enables backwards reading, but only as
> limited by count. Better would be a program, say revfile, that simply
> reads backwards by lines. Then tail p  has an elegant implementation:
>        revfile p | head | revfile

The GNU coreutils provides "tac" (c-a-t backwards) which does that
job. It was adopted from a long-ago posting of same on comp.sources.something.
It should be standard on just about any Linux system.

(It too has too many options, but let's not go there.)

Thanks,

Arnold


More information about the TUHS mailing list