help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Most used words in current buffer


From: Udyant Wig
Subject: Re: Most used words in current buffer
Date: Fri, 20 Jul 2018 11:22:12 +0530
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 07/19/2018 10:49 PM, Nick Dokos wrote:
> IIRC, Kernighan & Pike say in the "Unix Programming Environment" that
> there *was* a `head' program, in addition to the `tail' program. It
> fell into disuse and disappeared almost immediately after sed became
> available. tail is still around, I guess both because the sed
> invocation for `tail -n' does not quite roll off the fingers the same
> way that 20q does -- see e.g
>
>
https://unix.stackexchange.com/questions/107387/emulate-tail-with-sed#107388
>
> -- but also because `tail -f' cannot be emulated by sed, at least not
> without a lot of effort and/or another program).

Well, in the interests of dispelling doubts around what Kernighan and
Pike say, I will quote the paragraph they wrote in regard to sed and
utilities equivalent to sed commands:

  With these ideas, it might seem sensible to write a program, called
  _head_, to print the first few lines of each filename argument.  But
  _sed 3q_ (or _10q_) is so easy to type that we've never felt the
  need.  We do, however, have an _ind_, since its equivalent _sed_
  command is harder to type.  (In the process of writing this book we
  replaced the existing 20-line C program by version 2 of the one-line
  implementation shown earlier).  There is no clear criterion for when
  it's worth making a separate command from a complicated command line;
  the best rule we've found is to put it in your _bin_ and see if you
  actually use it.

On the point of 'tail -f', yes, it is a very useful command that would
indeed be non-trivial to build using sed.

Udyant Wig
-- 
We make our discoveries through our mistakes: we watch one another's
success: and where there is freedom to experiment there is hope to
improve.
                                -- Arthur Quiller-Couch



reply via email to

[Prev in Thread] Current Thread [Next in Thread]