home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / mod.std.unix.v9 / text0034.txt < prev    next >
Encoding:
Internet Message Format  |  1987-06-30  |  1.4 KB

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