RTFM... I wish... (Re: appolgies "obviously")

Jonathan I. Kamens jik at athena.mit.edu
Mon May 15 05:06:23 AEST 1989


In article <2859 at buengc.BU.EDU> bph at buengc.bu.edu (Blair P. Houghton) writes:
>In that vein, I've R'ed TMFM, and I've twiddled the permutations, but
>I just can't seem to get sed(1) to print lines 110 through 115 of
>a file.  It seems the most basic of things, but sed(1) insists on
>printing the whole file, no matter what I do...

  The key here is that sed(1) will always print its input lines to the
standard output unless you tell it not to, so what you have to do is
tell it to delete everything *except* for the lines you want to print.
This should work:

  sed '110,115 !d' <filename>

Of  course, you'll have to quote the ! with a backslash if you use csh
(and possibly ksh, although I'm not sure).

Jonathan Kamens			              USnail:
MIT Project Athena				410 Memorial Drive, No. 223F
jik at Athena.MIT.EDU				Cambridge, MA 02139-4318
Office: 617-253-4261			      Home: 617-225-8218



More information about the Comp.unix.questions mailing list