home *** CD-ROM | disk | FTP | other *** search
- From: guy%gorodish@Sun.COM (Guy Harris)
- Date: 29 Jan 87 07:20:35 GMT
- Reply-To: guy@sun.UUCP (Guy Harris)
- Organization: Sun Microsystems, Mountain View
-
- >>From: colonel@sunybcs.UUCP (Col. G. L. Sicherman)
- >>I'd like to see a program that does what tail does, except that if
- >>you say "tail +n" it skips the first n units.
-
- sed -n '<n>,$p'
-
- will do the job quite nicely.
-
- >>And how about a "head" with the same syntax as tail/trail?
- >>("head xx file; tail xx file" = "cat file")
- >
- >Try 'dd bs=n skip=1' - actually, what you need is a 'line' modifier to
- >dd, in addition to chars, blocks and k.
-
- Well, 4BSD has such a "head" command, and writing one for systems
- lacking it would probably take less work than adding a "line"
- modifier to "dd" (which would be totally inappropriate for "dd", just
- as "-v" is inappropriate for "cat"). On the other hand,
-
- sed -n '1,<n>p'
-
- will do the job quite nicely here, too. (I suspect it may still read
- the rest of the file, but sticking in optimizations to avoid this are
- left as an exercise to the reader.)
-
- Let's not use 1003.2 as a chance to add every feature we want to some
- UNIX command, or to tweak their behavior to fit something that seemed
- convenient one day last month, or to add our favorite command. The
- commands standardized in 1003.2 should be *tools* - such as, to pick
- a random example, "sed".
-
- Volume-Number: Volume 9, Number 35
-
-