On a prior page we spake of ‘tail -f’, dash eff, and its sublime abilities in watching the Lines of an e’er-growing File. We oft wield this deft implement, especially when looking at logges, as from stdout or Apatche or Railes. Yet the flow therefrom may make us quail, as the data pours o’er us faster than profane names pour from the blacksmith o’er the white cat he finds forever under-foot.
What can staunch this torrent? To be sure, ye may pipeth it through ‘cut’, yet while that reduces the quantity somewhat, still it pours forth each and every Line. The filter we need for this task, to ajoin to the end of this pipe, is ‘grep’. We’ve discoursed upon this fine instrument previously as well.
This is fine and well useful, yet there is more on offer. Of course ye may avail yourself of the usual ‘grep’ Options, such as ‘-i’, dash eye, to ignore the case of thy search. We may also often wish to search for multiple Things upon the Lines thus filtered, and there be more than one way to accomplish this. The first may be done if the order of your multiple Things is always the same, and that is to simply search with a Regular Expression that may matcheth your quarry. Id est,
Sometimes the order is less predictable, or we want to match several different terms. Then does the Option ‘-e’, dash ee, come to hand. It can be used once, twice, a hundred times, all in the same invocation. Id est,
Lastly, a tip if ye find yourself stringing very many of these pipes together one after another after ‘tail’. The stdout and stdin flowing between is buffered to save Resources, but it may be that this delays the results ye seek. If thy desire is to pipe thy ‘grep’ output along to another Tool, then use the Option ‘--line-buffered’, ‘dash dash line buffered’. This flushes the ‘grep’ output through yon pipes without delay. Id est,