Article View: mod.std.unix
Article #468Re: tail in 1003.2 Commands
From: std-unix
Date: Thu, 29 Jan 1987 23:09
Date: Thu, 29 Jan 1987 23:09
37 lines
2048 bytes
2048 bytes
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
Technical Details
Message-ID:
<7001@ut-sally.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!cbosgd!ulysses!gatech!ut-sally!std-unixReferences:
<6710@ut-sally.UUCP> <6783@ut-sally.UUCP> <6882@ut-sally.UUCP> <6966@ut-sally.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!cbosgd!ulysses!gatech!ut-sally!std-unix From: std-unix@ut-sally.UUCP Newsgroups: mod.std.unix Subject: Re: tail in 1003.2 Commands Message-ID: <7001@ut-sally.UUCP> Date: Thu, 29-Jan-87 18:09:35 EST Article-I.D.: ut-sally.7001 Posted: Thu Jan 29 18:09:35 1987 Date-Received: Sat, 31-Jan-87 01:50:20 EST References: <6710@ut-sally.UUCP> <6783@ut-sally.UUCP> <6882@ut-sally.UUCP> <6966@ut-sally.UUCP> Organization: IEEE P1003 Portable Operating System for Computer Environments Committee Lines: 37 Approved: jsq@sally.utexas.edu