Gentoo Archives: gentoo-user

From: Paul Hartman <paul.hartman+gentoo@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Not head, not tail, maybe belly
Date: Wed, 22 Sep 2010 15:44:39
Message-Id: AANLkTim9aY3=7GZTSTDCCjC46b79aQgVaHCWpiRZmyCx@mail.gmail.com
In Reply to: [gentoo-user] Not head, not tail, maybe belly by Al
1 On Wed, Sep 22, 2010 at 9:53 AM, Al <oss.elmar@××××××××××.com> wrote:
2 > Hi,
3 >
4 > I am looking for a program similar to head or tail. It should display
5 > a given range of lines or take a line and a context number like grep.
6 >
7 > Any suggestions? Thanks in advance.
8
9 sed -n 5,8p filename
10
11 where 5 is first line in the range and 8 is the last line.
12
13 If you want to view multiple ranges use the same X,Yp syntax but
14 preceed each with -e. For example
15
16 sed -n -e 5,8p -e 12,17p filename