[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shell Question..



Rus Foster said on Mon, Jul 21, 2003 at 11:54:21AM -0700:
> Hi All,
> No strictly on topic but can anyone think of a better way to print out
> line x of a file in Shell Script. Best I have so far is (in pseudo code)
> 
> cat /tmp/file | head -$x | tail -$x+1
> 
> Anything better or a perl one liner?

You don't need cat:

head -$x < /tmp/file | tail -1

M

Attachment: pgpYHXkEhRrc2.pgp
Description: PGP signature


Reply to: